@@ -96,17 +96,35 @@ export async function generateProject(clickedFileUri: vscode.Uri | undefined): P
9696 try {
9797 await generateRestClient ( jarCommand ) ;
9898 } catch ( e ) {
99- if ( e . message . includes ( SPEC_VALIDATION_EXCEPTION ) ) {
100- const selection = await vscode . window . showErrorMessage (
101- `The provided yaml ${ yamlType } failed the OpenAPI specification validation. Would you like to generate without specification validation?` ,
102- ...[ "Yes" , "No" ]
103- ) ;
104- if ( selection === "Yes" ) {
105- jarCommand += " --skip-validate-spec" ;
106- await generateRestClient ( jarCommand ) ;
99+ console . error ( e ) ;
100+ if ( e . message . includes ( jarCommand ) ) {
101+ // get error description returned from executing jar command
102+ let err = e . message . trim ( ) . split ( jarCommand ) ;
103+ err = err [ 1 ] . trim ( ) . split ( "\n" ) [ 0 ] ;
104+
105+ // catch spec validation error
106+ if ( err . includes ( SPEC_VALIDATION_EXCEPTION ) ) {
107+ const selection = await vscode . window . showErrorMessage (
108+ `The provided yaml ${ yamlType } failed the OpenAPI specification validation. Would you like to generate without specification validation?` ,
109+ ...[ "Yes" , "No" ]
110+ ) ;
111+ if ( selection === "Yes" ) {
112+ jarCommand += " --skip-validate-spec" ;
113+ await generateRestClient ( jarCommand ) ;
114+ } else {
115+ return ;
116+ }
107117 } else {
118+ vscode . window . showErrorMessage (
119+ `Failed to generate a MicroProfile Rest Client interface from the provided yaml ${ yamlType } : ${ err } `
120+ ) ;
108121 return ;
109122 }
123+ } else {
124+ vscode . window . showErrorMessage (
125+ "Failed to generate MicroProfile Rest Client interface template."
126+ ) ;
127+ return ;
110128 }
111129 }
112130
0 commit comments