Skip to content

Commit ed20d6d

Browse files
committed
Fix typings in service.worker.runtime.graphql.middlewares.error
Only handle errors which are instances of ApolloError. This particular error handler expects errors will come as extensions of ApolloError, otherwise the operations within the error handler wouldn't make any sense.
1 parent f436d7a commit ed20d6d

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

  • src/service/worker/runtime/graphql/middlewares

src/service/worker/runtime/graphql/middlewares/error.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { formatApolloErrors } from 'apollo-server-errors'
1+
import { ApolloError, formatApolloErrors } from 'apollo-server-errors'
22
import { uniqBy } from 'ramda'
33

44
import { LINKED } from '../../../../../constants'
@@ -74,6 +74,9 @@ export async function graphqlError (ctx: GraphQLServiceContext, next: () => Prom
7474
}
7575
}
7676
catch (e) {
77+
if (!(e instanceof ApolloError)) {
78+
throw e
79+
}
7780
if (e.code === cancelledErrorCode) {
7881
ctx.status = cancelledRequestStatus
7982
return

0 commit comments

Comments
 (0)