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

Catch formatError #174

Merged
merged 8 commits into from
Oct 17, 2016
Merged

Conversation

nicolaslopezj
Copy link
Contributor

@nicolaslopezj nicolaslopezj commented Oct 17, 2016

When formatError throws an error, the request nevers responds. In this PR I add try/catch to formatError and use the default one if the provided fails.

This fixes #171

TODO:

  • Update CHANGELOG.md with your change (include reference to issue & this PR)
  • Make sure all of the significant new logic is covered by tests
  • Rebase your changes on master so that they can be merged easily
  • Make sure all tests and linter rules pass

return options.formatError(error);
} catch (err) {
console.error('Error in formatError function:', err);
return formatError(error);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

People might be using formatError to hide some information, for example maybe they don't want the error message to leak to the client. I'd suggest the best option is to return a generic "Internal server error" message instead.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

@stubailo
Copy link
Contributor

Looks great to me, thanks!

@stubailo stubailo merged commit 36ae6d4 into apollographql:master Oct 17, 2016
@nicolaslopezj nicolaslopezj deleted the catch-formatError branch October 17, 2016 19:35
trevor-scheer pushed a commit that referenced this pull request Oct 17, 2022
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
trevor-scheer pushed a commit that referenced this pull request Oct 17, 2022
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
trevor-scheer pushed a commit that referenced this pull request Oct 19, 2022
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 23, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Loading query for ever when there are syntax errors
2 participants