30
30
import com .intellij .lang .jsgraphql .types .schema .idl .SchemaParser ;
31
31
import com .intellij .lang .jsgraphql .types .schema .idl .SchemaPrinter ;
32
32
import com .intellij .lang .jsgraphql .types .schema .idl .UnExecutableSchemaGenerator ;
33
+ import com .intellij .lang .jsgraphql .types .schema .idl .errors .SchemaProblem ;
33
34
import com .intellij .lang .jsgraphql .types .util .EscapeUtil ;
34
35
import com .intellij .lang .jsgraphql .v1 .ide .project .JSGraphQLLanguageUIProjectService ;
35
36
import com .intellij .notification .Notification ;
@@ -267,9 +268,11 @@ public String printIntrospectionAsGraphQL(@NotNull Map<String, Object> introspec
267
268
);
268
269
269
270
if (schemaInfo .hasErrors ()) {
270
- for (GraphQLError error : schemaInfo .getErrors ()) {
271
+ List <GraphQLError > errors = schemaInfo .getErrors ();
272
+ for (GraphQLError error : errors ) {
271
273
LOG .warn (error .getMessage ());
272
274
}
275
+ throw new SchemaProblem (errors );
273
276
}
274
277
275
278
final StringBuilder sb = new StringBuilder (new SchemaPrinter (options ).print (schemaInfo .getSchema ()));
@@ -295,7 +298,12 @@ public String printIntrospectionAsGraphQL(@NotNull Map<String, Object> introspec
295
298
}
296
299
}
297
300
}
298
- return sb .toString ();
301
+
302
+ String sdl = sb .toString ();
303
+ if (LOG .isDebugEnabled ()) {
304
+ LOG .debug (sdl );
305
+ }
306
+ return sdl ;
299
307
}
300
308
301
309
@ SuppressWarnings ("unchecked" )
@@ -396,13 +404,13 @@ void createOrUpdateIntrospectionOutputFile(@NotNull String schemaText,
396
404
CodeStyleManager .getInstance (myProject ).reformat (psiFile );
397
405
}
398
406
});
399
- } catch (IOException ioe ) {
400
- LOG .info (ioe );
407
+ } catch (IOException e ) {
408
+ LOG .info (e );
401
409
Notifications .Bus .notify (new Notification (
402
410
GraphQLNotificationUtil .NOTIFICATION_GROUP_ID ,
403
411
GraphQLBundle .message ("graphql.notification.error.title" ),
404
412
GraphQLBundle .message ("graphql.notification.unable.to.create.file" ,
405
- outputFileName , introspectionSourceFile .getParent ().getPath (), GraphQLNotificationUtil .formatExceptionMessage (ioe )),
413
+ outputFileName , introspectionSourceFile .getParent ().getPath (), GraphQLNotificationUtil .formatExceptionMessage (e )),
406
414
NotificationType .ERROR
407
415
));
408
416
}
0 commit comments