Skip to content

Commit 00af0b6

Browse files
author
naman-contentstack
committed
updated the rror message
1 parent d0578cb commit 00af0b6

File tree

1 file changed

+10
-13
lines changed

1 file changed

+10
-13
lines changed

src/commands/tsgen.ts

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,7 @@ export default class TypeScriptCodeGeneratorCommand extends Command {
218218
bold: true,
219219
});
220220
if (hint) {
221-
cliux.print(`Hint: ${hint}`, { color: "yellow" });
221+
cliux.print(`Tip: ${hint}`, { color: "yellow" });
222222
}
223223
cliux.print(`Error context: ${error?.context || "graphql"}`, {
224224
color: "cyan",
@@ -289,12 +289,12 @@ export default class TypeScriptCodeGeneratorCommand extends Command {
289289
switch (errorCode) {
290290
case "INVALID_INTERFACE_NAME":
291291
case "INVALID_CONTENT_TYPE_UID":
292-
errorMessage = `TypeScript syntax error detected in generated types`;
293-
hint = `Content type "${error?.details?.uid || "unknown"}" starts with a number, which creates invalid TypeScript interface names. Since UIDs cannot be changed, use the --prefix flag to add a valid prefix to all interface names (e.g., --prefix "ContentType").`;
292+
errorMessage = `TypeScript syntax error detected in the generated types.`;
293+
hint = `Use a prefix to ensure all interface names are valid TypeScript identifiers.`;
294294
break;
295295
case "INVALID_GLOBAL_FIELD_REFERENCE":
296-
errorMessage = `TypeScript syntax error detected in generated types`;
297-
hint = `Global field "${error?.details?.uid || "unknown"}" references content type "${error?.details?.reference_to || "unknown"}" which starts with a number. Since UIDs cannot be changed, use the --prefix flag to add a valid prefix to all interface names (e.g., --prefix "ContentType").`;
296+
errorMessage = `TypeScript syntax error detected in the generated types.`;
297+
hint = `Use a prefix to ensure all interface names are valid TypeScript identifiers.`;
298298
break;
299299
case "VALIDATION_ERROR":
300300
errorMessage = `TypeScript syntax error detected in generated types`;
@@ -328,7 +328,7 @@ export default class TypeScriptCodeGeneratorCommand extends Command {
328328
error?.message ||
329329
"An error occurred while generating TypeScript types";
330330
hint =
331-
"Since UIDs cannot be changed, use the --prefix flag to add a valid prefix to all interface names (e.g., --prefix 'ContentType').";
331+
"Use a prefix to ensure all interface names are valid TypeScript identifiers.";
332332
}
333333

334334
// Display our formatted error first
@@ -337,7 +337,7 @@ export default class TypeScriptCodeGeneratorCommand extends Command {
337337
bold: true,
338338
});
339339
if (hint) {
340-
cliux.print(`Hint: ${hint}`, { color: "yellow" });
340+
cliux.print(`Tip: ${hint}`, { color: "yellow" });
341341
}
342342
cliux.print(`Error context: ${error?.context || "tsgen"}`, {
343343
color: "cyan",
@@ -369,11 +369,8 @@ export default class TypeScriptCodeGeneratorCommand extends Command {
369369
case "INVALID_INTERFACE_NAME":
370370
case "INVALID_CONTENT_TYPE_UID":
371371
case "INVALID_GLOBAL_FIELD_REFERENCE":
372-
errorMessage = `TypeScript syntax error detected in generated types`;
373-
hint = error?.error_message || "A validation error occurred";
374-
if (error?.details?.suggestion) {
375-
hint += `. ${error.details.suggestion}`;
376-
}
372+
errorMessage = `TypeScript syntax error detected in the generated types.`;
373+
hint = `Use a prefix to ensure all interface names are valid TypeScript identifiers.`;
377374
break;
378375
default:
379376
errorMessage =
@@ -395,7 +392,7 @@ export default class TypeScriptCodeGeneratorCommand extends Command {
395392
bold: true,
396393
});
397394
if (hint) {
398-
cliux.print(`Hint: ${hint}`, { color: "yellow" });
395+
cliux.print(`Tip: ${hint}`, { color: "yellow" });
399396
}
400397
cliux.print(`Error context: ${error?.context || "tsgen"}`, {
401398
color: "cyan",

0 commit comments

Comments
 (0)