-
Notifications
You must be signed in to change notification settings - Fork 214
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
Goliath swallows server errors as 400 #50
Comments
Oh, so the extra 400 response is related to using a browser for an API that wants to give a JSON response. Still doesn't make a lot of sense to me though. |
If the browser is chrome, the second request is for favicon.ico usually. |
Exceptions are caught and handled by the API. The problem being, if you throw an exception inside the API it will end up in no-where land unless it's caught. The middlewares would have already returned at that point and the ASYNC_CALLBACK has to be used. So, we catch the exception, turn it into a 400 response, and fire the ASYNC_CALLBACKS. We could possibly also stuff the exception into rack.exception so you can still access it if desired. Then, if you want, you can change the response in your async middleware for exceptions. Would that work for you? |
Yes, I need access to the original exception, so rack.exception would be good. The other issue is the use of a 400 error code, which indicates a client error. In this case it should be a 500. |
K, feel free to move it to a 500 from a 400 and add in rack.exception. |
pull request in #51 |
I put a an exception in my response
fail "WTF?"
Here is the output I see:
So there is a 400 instead of 500. This issue has also alerted me to the fact that I now see an extra 400 request tacked onto every request- not sure where I went wrong there :)
The text was updated successfully, but these errors were encountered: