Skip to content

Commit

Permalink
fix: Fix subscribe error handling (#21)
Browse files Browse the repository at this point in the history
  • Loading branch information
taion authored Aug 11, 2018
1 parent 247ca09 commit fe9308b
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/AuthorizedSocketConnection.js
Original file line number Diff line number Diff line change
Expand Up @@ -190,8 +190,12 @@ export default class AuthorizedSocketConnection<TContext, TCredentials> {
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) {
Expand Down

0 comments on commit fe9308b

Please sign in to comment.