File tree Expand file tree Collapse file tree 2 files changed +22
-4
lines changed Expand file tree Collapse file tree 2 files changed +22
-4
lines changed Original file line number Diff line number Diff line change @@ -134,7 +134,11 @@ export default class TypeScriptCodeGeneratorCommand extends Command {
134134 `Successfully added the GraphQL schema type definitions to '${ outputPath } '.` ,
135135 ) ;
136136 } catch ( error : any ) {
137- this . error ( error . error_message , { exit : 1 } ) ;
137+ const errorMessage =
138+ error ?. error_message ||
139+ error ?. message ||
140+ "An error occurred while generating GraphQL types" ;
141+ this . error ( errorMessage , { exit : 1 } ) ;
138142 }
139143 } else {
140144 // Generate the Content Types TypeScript definitions
@@ -154,11 +158,19 @@ export default class TypeScriptCodeGeneratorCommand extends Command {
154158
155159 // this.log(`Wrote ${outputPath} Content Types to '${result.outputPath}'.`)
156160 } catch ( error : any ) {
157- this . error ( error . error_message , { exit : 1 } ) ;
161+ const errorMessage =
162+ error ?. error_message ||
163+ error ?. message ||
164+ "An error occurred while generating TypeScript types" ;
165+ this . error ( errorMessage , { exit : 1 } ) ;
158166 }
159167 }
160168 } catch ( error : any ) {
161- this . error ( error as any , { exit : 1 } ) ;
169+ const errorMessage =
170+ error ?. error_message ||
171+ error ?. message ||
172+ "An unexpected error occurred" ;
173+ this . error ( errorMessage , { exit : 1 } ) ;
162174 }
163175 }
164176}
Original file line number Diff line number Diff line change @@ -155,8 +155,14 @@ describe("Integration Test for tsgen command", () => {
155155 namespace ,
156156 ] ;
157157
158+ console . log ( "Running GraphQL namespace test with args:" , args ) ;
158159 const result = spawnSync ( cmd , args , { encoding : "utf-8" } ) ;
159- console . error ( result ) ;
160+ console . error ( "GraphQL Namespace Test Result:" , {
161+ status : result . status ,
162+ stdout : result . stdout ,
163+ stderr : result . stderr ,
164+ error : result . error ,
165+ } ) ;
160166
161167 expect ( result . status ) . toBe ( 0 ) ;
162168 expect ( fs . existsSync ( outputFilePath ) ) . toBeTruthy ( ) ;
You can’t perform that action at this time.
0 commit comments