Skip to content

Commit 443cc10

Browse files
Merge pull request #420 from contentstack/fix/DX-3459-error-message-improve
improved error messages
2 parents bbd09f6 + 21a930c commit 443cc10

File tree

9 files changed

+4404
-5419
lines changed

9 files changed

+4404
-5419
lines changed

.github/CODEOWNERS

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,9 @@
1-
* @contentstack/security-admin
1+
* @contentstack/devex-pr-reviewers
2+
3+
.github/workflows/sca-scan.yml @contentstack/security-admin
4+
5+
**/.snyk @contentstack/security-admin
6+
7+
.github/workflows/policy-scan.yml @contentstack/security-admin
8+
9+
.github/workflows/issues-jira.yml @contentstack/security-admin

.github/workflows/secrets-scan.yml

Lines changed: 0 additions & 29 deletions
This file was deleted.

.talismanrc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
threshold: medium
22
fileignoreconfig:
33
- filename: package-lock.json
4-
checksum: 1cfef37e0c387725843e0178fa7587e6c7c55ca61d938995244384ecc899cab7
4+
checksum: 942456bb38f0c8bcb78e186770c3840adeae7f9a813b8ddb015740f68610d654
55
- filename: .github/workflows/secrets-scan.yml
66
checksum: d79ec3f3288964f7d117b9ad319a54c0ebc152e35f69be8fde95522034fdfb2a
77
version: "1.0"

package-lock.json

Lines changed: 4369 additions & 5363 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/commands/app/deploy.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ export default class Deploy extends AppCLIBaseCommand {
100100
);
101101
break;
102102
default:
103-
this.log("Please provide a valid Hosting Type.", "error");
103+
this.log("Provide a valid hosting type.", "error");
104104
return;
105105
}
106106

@@ -207,7 +207,7 @@ export default class Deploy extends AppCLIBaseCommand {
207207
);
208208
url = await this.handleNewProject(config, updateHostingPayload);
209209
} else {
210-
this.log("Please provide a valid launch project.", "error");
210+
this.log("Provide a valid Launch project.", "error");
211211
return;
212212
}
213213

src/messages/index.ts

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,29 @@
11
const errors = {
2-
NOT_EMPTY: "{value} cannot be empty.",
3-
INVALID_APP_ID: "Please enter a valid app UID.",
2+
NOT_EMPTY: "{value} is required and cannot be empty.",
3+
INVALID_APP_ID: "Enter a valid app UID.",
44
ORG_UID_NOT_FOUND:
55
"Organization UID not found. Please enter a valid organization UID.",
6-
BASE_URL_EMPTY: "Developer Hub URL cannot be empty.",
7-
INVALID_ORG_UID: "Please enter a valid organization UID.",
6+
BASE_URL_EMPTY: "Developer Hub URL is required.",
7+
INVALID_ORG_UID: "Enter a valid organization UID.",
88
PATH_NOT_FOUND:
9-
"Failed to locate the provided path '{path}'. Please enter a valid path.",
9+
"Path {path} not found. Enter a valid path.",
1010
INVALID_NAME:
11-
"Please enter a valid name that is {min} to {max} characters long.",
11+
"Name must be between {min} and {max} characters.",
1212
FILE_GENERATION_FAILURE:
13-
"Failed to generate the file! Please try running the command again.",
14-
APP_CREATION_FAILURE: "App could not be registered on Developer Hub.",
13+
"File generation failed. Try running the command again.",
14+
APP_CREATION_FAILURE: "Failed to register app on Developer Hub.",
1515
APP_UID_NOT_MATCH:
16-
"Provided app UID is not matching with the app manifest.json app UID",
16+
"App UID doesn't match the value in manifest.json.",
1717
APP_CREATION_CONSTRAINT_FAILURE:
18-
"App could not be registered. Please go through the constraints on the app name and try running the command again.",
18+
"App registration failed. Check the name constraints and try again.",
1919
APP_CREATE_FAILURE_AND_ROLLBACK:
20-
"App creation should fail and rollback",
20+
"App creation failed. Changes have been rolled back.",
2121
APP_INVALID_ORG:
22-
"App could not be registered. Please verify the inputs and try again.",
22+
"App registration failed. Verify the inputs and try again.",
2323
DUPLICATE_APP_NAME:
24-
"The {appName} app already exists. Please create an app with a different name.",
24+
"App {appName} already exists. Use a different name.",
2525
INVALID_URL:
26-
"Please enter a valid URL. The URL should start with http:// or https://",
26+
"Enter a valid URL starting with http:// or https://.",
2727
};
2828

2929
const commonMsg = {
@@ -37,10 +37,10 @@ const commonMsg = {
3737
"Enter the Developer Hub Base URL for the {name} region: ",
3838
APP_UID: "Provide the app UID of an existing app.",
3939
APP_TYPE_DESCRIPTION: "Type of app",
40-
CONTACT_SUPPORT: "Please contact the support team.",
40+
CONTACT_SUPPORT: "Contact the support team for help.",
4141
STACK_API_KEY: "API key of the stack where the app operation is to be performed.",
4242
USER_TERMINATION: "Process terminated by the user.",
43-
CLI_APP_CLI_LOGIN_FAILED: 'You are not logged in. Please login with command $ csdx auth:login'
43+
CLI_APP_CLI_LOGIN_FAILED: "You're not logged in. Run $ csdx auth:login to continue."
4444
};
4545

4646
const appCreate = {
@@ -130,7 +130,7 @@ const deployAppMsg = {
130130
HOSTING_TYPE: "Choose a valid Hosting Type.",
131131
CONFIG_FILE: "[optional] Please enter the path of the config file.",
132132
APP_UPDATE_TERMINATION_MSG: "The app is already connected to the Launch project. Skipping the app hosting updates process.",
133-
DISCONNECT_PROJECT: "Are you sure you wan to disconnect the Launch project?",
133+
DISCONNECT_PROJECT: "Disconnect the Launch project? This action can't be undone.",
134134
PROJECT_NOT_FOUND: "We couldn't find the project. Please enter a valid project name.",
135135
PROJECT_NAME_CONFLICT_FAILED: "Unable to resolve the project name conflict."
136136
}

test/unit/commands/app/create.test.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -345,7 +345,7 @@ describe("app:create", () => {
345345
],
346346
{ root: process.cwd() }
347347
);
348-
expect(result.stdout).to.contain("App could not be registered");
348+
expect(result.stdout).to.contain("App registration failed");
349349
});
350350
});
351351

@@ -394,7 +394,7 @@ describe("app:create", () => {
394394
"--data-dir",
395395
process.cwd(),
396396
]);
397-
expect(result.stdout).to.contain("App could not be registered");
397+
expect(result.stdout).to.contain("App registration failed");
398398
});
399399
});
400400

@@ -467,7 +467,7 @@ describe("app:create", () => {
467467
"--data-dir",
468468
process.cwd(),
469469
]);
470-
expect(result.stdout).to.contain("App could not be registered");
470+
expect(result.stdout).to.contain("App registration failed");
471471
});
472472
});
473473
});

test/unit/commands/app/deploy.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ describe("app:deploy", () => {
186186
const { stdout } = await runCommand(["app:deploy"], {
187187
root: process.cwd(),
188188
});
189-
expect(stdout).to.contain("Please provide a valid Hosting Type.");
189+
expect(stdout).to.contain("Provide a valid hosting type.");
190190
});
191191

192192
it("should handle new project creation with hosting-with-launch", async () => {

test/unit/commands/app/get.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ describe("app:get", () => {
117117
beforeEach(() => {
118118
sandbox
119119
.stub(fs, "readdirSync")
120-
.returns(["manifest.json"] as unknown as fs.Dirent[]);
120+
.returns(["manifest.json"] as any);
121121
sandbox.stub(cliux, "confirm").resolves(false);
122122
sandbox.stub(cliux, "inquire").resolves("test org 1");
123123

@@ -156,7 +156,7 @@ describe("app:get", () => {
156156
beforeEach(() => {
157157
sandbox
158158
.stub(fs, "readdirSync")
159-
.returns(["manifest.json"] as unknown as fs.Dirent[]);
159+
.returns(["manifest.json"] as any);
160160
sandbox.stub(cliux, "confirm").resolves(true);
161161
sandbox.stub(cliux, "inquire").resolves("test org 1");
162162

0 commit comments

Comments
 (0)