1+ import { GraphQLError } from 'graphql' ;
2+
13import WorkerKV from '../utils/worker-kv.mjs' ;
24
35class MapAPI extends WorkerKV {
@@ -16,7 +18,7 @@ class MapAPI extends WorkerKV {
1618 for ( const map of cache . Map ) {
1719 if ( map . id === id || map . tarkovDataId === id ) return map ;
1820 }
19- return Promise . reject ( new Error ( `No map found with id ${ id } ` ) ) ;
21+ return Promise . reject ( new GraphQLError ( `No map found with id ${ id } ` ) ) ;
2022 }
2123
2224 async getMapsByNames ( context , info , names , maps = false ) {
@@ -25,7 +27,7 @@ class MapAPI extends WorkerKV {
2527 maps = cache . Map ;
2628 }
2729 const searchStrings = names . map ( name => {
28- if ( name === '' ) throw new Error ( 'Searched map name cannot be blank' ) ;
30+ if ( name === '' ) throw new GraphQLError ( 'Searched map name cannot be blank' ) ;
2931 return name . toLowerCase ( ) ;
3032 } ) ;
3133
@@ -45,7 +47,7 @@ class MapAPI extends WorkerKV {
4547 maps = cache . Map ;
4648 }
4749 const searchStrings = enemies . map ( name => {
48- if ( name === '' ) throw new Error ( 'Searched enemy name cannot be blank' ) ;
50+ if ( name === '' ) throw new GraphQLError ( 'Searched enemy name cannot be blank' ) ;
4951 return name . toLowerCase ( ) ;
5052 } ) ;
5153
@@ -76,7 +78,7 @@ class MapAPI extends WorkerKV {
7678 bosses = Object . values ( cache . MobInfo ) ;
7779 }
7880 const searchStrings = names . map ( name => {
79- if ( name === '' ) throw new Error ( 'Searched boss name cannot be blank' ) ;
81+ if ( name === '' ) throw new GraphQLError ( 'Searched boss name cannot be blank' ) ;
8082 return name . toLowerCase ( ) ;
8183 } ) ;
8284
0 commit comments