Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(server): Close socket if onSubscribe returns invalid array #53

Merged
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
refactor: misconfiguration is serious
  • Loading branch information
enisdenjo committed Nov 4, 2020
commit a968b9839ab1b56135f964f13487e91db19c6827
8 changes: 3 additions & 5 deletions src/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -553,11 +553,9 @@ export function createServer(
if (areGraphQLErrors(maybeExecArgsOrErrors)) {
return await emit.error(maybeExecArgsOrErrors);
} else if (Array.isArray(maybeExecArgsOrErrors)) {
return await emit.error([
new GraphQLError(
'Invalid return value from onSubscribe hook, expected an array of GraphQLError objects',
),
]);
throw new Error(
'Invalid return value from onSubscribe hook, expected an array of GraphQLError objects',
);
}
// not errors, is exec args
execArgs = maybeExecArgsOrErrors;
Expand Down