File tree Expand file tree Collapse file tree 1 file changed +7
-7
lines changed
Expand file tree Collapse file tree 1 file changed +7
-7
lines changed Original file line number Diff line number Diff line change @@ -16,11 +16,6 @@ export async function generateGqlTypes(fetch: ServerSideFetch = app.build()) {
1616 consola . info ( "Generating GraphQL types..." ) ;
1717 const introspection = await introspect ( fetch ) ;
1818
19- if ( introspection . errors ) {
20- console . error ( "Introspection errors:" , introspection . errors ) ;
21- throw Error ( "Introspection failed" , { cause : introspection . errors } ) ;
22- }
23-
2419 const {
2520 queryType,
2621 mutationType,
@@ -147,7 +142,12 @@ async function introspect(fetch: ServerSideFetch): Promise<any> {
147142 method : "POST" ,
148143 } ) ;
149144 const res = await fetch ( request ) ;
150- if ( res . ok ) return await res . json ( ) ;
145+ if ( ! res . ok )
146+ throw Error ( "Introspection request failed: " + ( await res . text ( ) ) ) ;
147+
148+ const json : any = await res . json ( ) ;
149+ if ( json . errors )
150+ throw Error ( "Introspection request failed: " + JSON . stringify ( json . errors ) ) ;
151151
152- throw Error ( "Introspection request failed: " + ( await res . text ( ) ) ) ;
152+ return json ;
153153}
You can’t perform that action at this time.
0 commit comments