Specify code of 500.1 for "Completely unhandled exception"?
- Dominant language
- JavaScript
- Stars
- 226
- Forks
- 235
- Avg merge
- 2d 22h
- Merged PRs (30d)
- 19
Description
If an error is thrown that is not a Problem, then in some cases, Backend will return a 500 error. The response body will be a JSON object with `message` and `details` properties. `message` will start with "Completely unhandled exception", and `details` will hold the stack trace if there is one. getodk/central#788 is an example of an error like this: the full message there is "Completely unhandled exception: request entity too large". The logic for errors of this kind seems to be located in `defaultErrorWriter()`:
https://github.com/getodk/central-backend/blob/5f86e228d88f4b5d38ab876815581e1d4134e1f7/lib/http/endpoint.js#L190-L213
I'm wondering whether we should add a `code` property to the JSON object so that the response is a full-fledged Problem. I think a code of 500.1 would make sense. Frontend knows how to handle errors that are Problems: by default, it will show the Problem message to the user. However, when an error response isn't a Problem, Frontend shows a generic error message, for example, "Something went wrong: error code 500." My instinct is that if we have a more informative error message, it would be useful to show that to the user.
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.