question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

500 Error handling suggestions

See original GitHub issue

The way 500 errors are currently handled is that exceptions are caught and GraphQL sends the literal error message back to the consumer in the error response, such as "message": "foo is not a function" and the error trace is swallowed. Instead, it would be preferable if it were a generic message, such as Internal Server Error, and the error were logged.

https://github.com/contrawork/graphql-helix/blob/12895db29a081afc710ab6532937e7129bd0bd8b/packages/core/lib/process-request.ts#L246-L248

Issue Analytics

  • State:open
  • Created 2 years ago
  • Reactions:1
  • Comments:13

github_iconTop GitHub Comments

1reaction
n1ru4lcommented, Nov 2, 2021

I think helix should only handle unexpected errors. E.g. if the schema is invalid or undefined etc or execute throws an error for some unknown reason

1reaction
n1ru4lcommented, Oct 24, 2021

@dburles We could introduce a safe by default error handler function that can be overwritten. The default implementation could simply map the error message to Internal server error and print the original error to the console with console.error? If people want to customize behavior they can override it. @dotansimha What do you think?

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to Fix a 500 Internal Server Error - Lifewire
The 500 Internal Server Error is a very general HTTP status code that means something has gone wrong on the website's server, but...
Read more >
How to handle 500 http errors - Stack Overflow
If you want to retrieve the response data, you need to use something like dataTask(with:completionHandler:) to send your request. That function ...
Read more >
HTTP 500 Internal Server Error: What It Means & How to Fix It
An HTTP 500 internal server error is a general error message. It covers unexpected issues that don't fit into existing error codes. HTTP...
Read more >
Best Practices for REST API Error Handling - Baeldung
500 errors signal that some issues or exceptions occurred on the server while handling a request.
Read more >
Error Handling - OWASP Cheat Sheet Series
Error handling is a part of the overall security of an application. ... HTTP Status 500 - For input string: "null" type Exception...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found