Open mcwebb opened 7 years ago
Probably pertains to #3.
Turns out this is actually possible by adding the code between square brackets somewhere in the error message (see 5540685), but that seems like a bit of a janky solution, and could lead to confusing behaviour if someone happens to include a number that matches the regex in their message but isn't actually a HTTP code.
At the very least the regex should be tightened to only accept valid HTTP codes.
Occasionally, in a promise chain for example, one may want to throw an error which doesn't cause a 500 response, because sometimes there are runtime errors which deserver a 400 response because it's the users fault.
Potentially there should be some custom errors which can be picked up by the dispatcher so that the application can easily tailor what error response is given to the client.