diff --git a/src/AuthorizedSocketConnection.js b/src/AuthorizedSocketConnection.js index b3d9fbfd..7a9fca3c 100644 --- a/src/AuthorizedSocketConnection.js +++ b/src/AuthorizedSocketConnection.js @@ -190,8 +190,12 @@ export default class AuthorizedSocketConnection { try { resultOrStream = await sourcePromise; } catch (err) { - this.subscriptions.delete(id); - throw err; + if (err instanceof GraphQLError) { + resultOrStream = { errors: [err] }; + } else { + this.subscriptions.delete(id); + throw err; + } } if (resultOrStream.errors != null) {