Open eliasnaur opened 9 years ago
It expects custom error message to be prefixed with the text mapped to each HTTP status code in net/http/status.go. If the prefix is missing, it reverts to 400 Bad Request. Even the predefined errors in go-endpoints suffer from this.
I'll fix it and submit a pull request as I found it annoying too.
if newErrorResponse in errors.go does not recognize the given error, it constructs an "internal server error" error as expected, but with a HTTP status code of 400, which is not. This is both surprising and confuses debugging by making it harder to differentiate unexpected errors, like internal server errors from expected, but invalid requests.
The relevant code is commented:
So it seems that I'm not the only one confused by this behaviour