@@ -241,28 +241,34 @@ cd ${folderPath}; graphql playground`)
241
241
let config
242
242
243
243
if ( input . cwd ) {
244
- configPath = findUp . sync ( [ '.graphqlconfig' , '.graphqlconfig.yml' ] , {
245
- cwd : input . cwd ,
246
- } )
247
- configString = configPath
248
- ? fs . readFileSync ( configPath , 'utf-8' )
249
- : undefined
250
- folderName = configPath
251
- ? path . basename ( path . dirname ( configPath ) )
252
- : undefined
253
- const rawConfig = getGraphQLConfig ( input . cwd ) . config
254
- config = await patchEndpointsToConfigData (
255
- resolveEnvsInValues ( rawConfig , input . env ) ,
256
- input . cwd ,
257
- input . env ,
258
- )
259
-
260
- if ( ! this . configContainsEndpoints ( config ) ) {
261
- const graphcoolNote = configString . includes ( 'graphcool' )
262
- ? 'Please make sure to add stages to your graphcool.yml'
263
- : ''
264
- alert ( `${ configPath } does not include any endpoints. ${ graphcoolNote } ` )
265
- return
244
+ try {
245
+ configPath = findUp . sync ( [ '.graphqlconfig' , '.graphqlconfig.yml' ] , {
246
+ cwd : input . cwd ,
247
+ } )
248
+ configString = configPath
249
+ ? fs . readFileSync ( configPath , 'utf-8' )
250
+ : undefined
251
+ folderName = configPath
252
+ ? path . basename ( path . dirname ( configPath ) )
253
+ : undefined
254
+ const rawConfig = getGraphQLConfig ( input . cwd ) . config
255
+ config = await patchEndpointsToConfigData (
256
+ resolveEnvsInValues ( rawConfig , input . env ) ,
257
+ input . cwd ,
258
+ input . env ,
259
+ )
260
+
261
+ if ( ! this . configContainsEndpoints ( config ) ) {
262
+ const graphcoolNote = configString . includes ( 'graphcool' )
263
+ ? 'Please make sure to add stages to your graphcool.yml'
264
+ : ''
265
+ alert (
266
+ `${ configPath } does not include any endpoints. ${ graphcoolNote } ` ,
267
+ )
268
+ return
269
+ }
270
+ } catch ( e ) {
271
+ //
266
272
}
267
273
}
268
274
@@ -271,15 +277,17 @@ cd ${folderPath}; graphql playground`)
271
277
JSON . stringify ( { cwd : input . cwd , id : remote . getCurrentWindow ( ) . id } ) ,
272
278
)
273
279
274
- this . setState ( {
280
+ const state = {
275
281
configString,
276
282
folderName,
277
283
configPath,
278
284
env : input . env ,
279
285
endpoint,
280
286
config,
281
287
platformToken,
282
- } )
288
+ }
289
+
290
+ this . setState ( state )
283
291
}
284
292
285
293
configContainsEndpoints ( config : GraphQLConfigData ) : boolean {
0 commit comments