Skip to content

Commit acacfd1

Browse files
author
naman-contentstack
committed
Merge branch 'development' into fix/DX-3573
2 parents 83d8c88 + a29670a commit acacfd1

File tree

2 files changed

+15
-15
lines changed

2 files changed

+15
-15
lines changed

src/commands/tsgen.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -132,12 +132,12 @@ export default class TypeScriptCodeGeneratorCommand extends Command {
132132

133133
if (token.type !== "delivery") {
134134
this.warn(
135-
"Possibly using a management token. You may not be able to connect to your Stack. Please use a delivery token.",
135+
"You might be using a management token. Connection may fail. Use a delivery token instead.",
136136
);
137137
}
138138

139139
if (!outputPath || !outputPath.trim()) {
140-
this.error("Please provide an output path.", { exit: 2 });
140+
this.error("Output path is required.", { exit: 2 });
141141
}
142142

143143
const config: StackConnectionConfig = {
@@ -160,7 +160,7 @@ export default class TypeScriptCodeGeneratorCommand extends Command {
160160
// Check if token has delivery type (required for GraphQL)
161161
if (token.type !== "delivery") {
162162
throw new Error(
163-
"GraphQL API requires a delivery token. Management tokens are not supported for GraphQL operations.",
163+
"GraphQL API requires a delivery token. Management tokens aren't supported.",
164164
);
165165
}
166166

@@ -186,7 +186,7 @@ export default class TypeScriptCodeGeneratorCommand extends Command {
186186
const result = await graphqlTS(graphqlConfig);
187187

188188
if (!result) {
189-
throw new Error("GraphQL API returned no result");
189+
throw new Error("No result returned by the GraphQL API.");
190190
}
191191

192192
fs.writeFileSync(outputPath, result);

src/lib/helper.ts

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -36,47 +36,47 @@ export const printFormattedError = (error: FormattedError, context: string) => {
3636
return;
3737
}
3838

39-
let errorMessage = "An unexpected error occurred";
39+
let errorMessage = "An unexpected error occurred. Try again.";
4040
let hint = "";
4141

4242
switch (errorCode) {
4343
case "AUTHENTICATION_FAILED":
44-
errorMessage = "Authentication failed";
44+
errorMessage = "Authentication failed. Check your credentials and try again.";
4545
hint = "Please check your API key, token, and region.";
4646
break;
4747
case "INVALID_CREDENTIALS":
48-
errorMessage = "Invalid credentials provided";
48+
errorMessage = "Invalid credentials. Please verify and re-enter your login details.";
4949
hint = "Please verify your API key, token, and region.";
5050
break;
5151
case "INVALID_INTERFACE_NAME":
5252
case "INVALID_CONTENT_TYPE_UID":
53-
errorMessage = "TypeScript syntax error detected in the generated types.";
53+
errorMessage = "Generated types contain a TypeScript syntax error.";
5454
hint =
5555
"Use a prefix to ensure all interface names are valid TypeScript identifiers.";
5656
break;
5757
case "INVALID_GLOBAL_FIELD_REFERENCE":
58-
errorMessage = "TypeScript syntax error detected in the generated types.";
58+
errorMessage = "Generated types contain a TypeScript syntax error.";
5959
hint =
6060
"Use a prefix to ensure all interface names are valid TypeScript identifiers.";
6161
break;
6262
case "VALIDATION_ERROR":
63-
errorMessage = "TypeScript syntax error detected in generated types";
63+
errorMessage = "Type generation failed due to a validation error.";
6464
hint =
6565
error?.error_message ||
66-
"Validation error occurred during type generation";
66+
"Type generation failed due to a validation error.";
6767
break;
6868
case "TYPE_GENERATION_FAILED":
69-
errorMessage = "Type generation failed due to an internal error";
69+
errorMessage = "Type generation failed due to a system error. Try again.";
7070
hint =
7171
error?.error_message ||
72-
"An unexpected error occurred during type generation";
72+
"Unexpected error during type generation. Try again.";
7373
break;
7474
default:
7575
errorMessage =
7676
error?.error_message ||
7777
error?.message ||
78-
"An unexpected error occurred";
79-
hint = "Please check the error details and try again.";
78+
"An unexpected error occurred. Try again.";
79+
hint = "Check the error details and try again.";
8080
}
8181

8282
// Print formatted error output

0 commit comments

Comments
 (0)