Skip to content
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

Rails log shows Internal Server Error when handling HTTPStatus exceptions #4

Open
haxney opened this issue Aug 12, 2011 · 7 comments
Open

Comments

@haxney
Copy link

haxney commented Aug 12, 2011

I am throwing an HTTPStatus::BadRequest exception in my controller when a request is invalid. The server correctly replies with a 400 status code and whatever template I give it, but the log in the server console shows:

Started GET "/bla?arg=invalid" for 127.0.0.1 at 2011-08-11 20:14:21 -0400
  Processing by BlasController#index as HTML
  Parameters: {"arg"=>"invalid"}
Completed 500 Internal Server Error in 1ms
Rendered exceptions/bad_request.html.erb within layouts/application (4.0ms)

So everything is returned correctly, but an incorrect value shows up in the log. It isn't the biggest problem, since as far as the client is concerned, everything is normal. But the log messages aren't very useful, since there's no differentiation between the different kinds of exceptions raised.

Thanks for an awesome yet simple gem!

@jstorimer
Copy link

This sounds like a bug I fixed in Rails (rails/rails#2133). Are you raising that exception inside of a rescue_from block?

@haxney
Copy link
Author

haxney commented Aug 12, 2011

I'm using Rails 3.0.9; was your fix included in that? I'm raising the exceptions from the controller, not anything fancy :)

@wvanbergen
Copy link
Owner

This patch seems to be in the master branch, so it hasn't been released yet and will be part of Rails 3.1.
Can you try if the problem persists in Rails master to make sure this is the actual problem?

@haxney
Copy link
Author

haxney commented Aug 12, 2011

Got it. I'll try this out when I get a chance.

@jstorimer
Copy link

It should also be in the next release of the 3.0.x branch, so 3.0.10.

@Fluxx
Copy link
Collaborator

Fluxx commented Sep 24, 2011

Any update on this issue?

@wvanbergen
Copy link
Owner

@jstorimer's patch was included in the Rails 3.0.10 release. Can you check if it works for you after upgrading? It should be working for 3.1 as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants