-
-
Notifications
You must be signed in to change notification settings - Fork 540
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
Render 500 custom template if an exception happens in a view or template #866
Conversation
@cveneziani this is a work in progress but it should render 500 page in production when an error happens, can you give it a try? |
I confirm, it's working. I do have the 500 page on errors happening in the view or the template. The only thing I'm missing is the bugtracker being notified for these errors. |
Hi @cveneziani what bug error tracker are you using? I'd like to test it. |
I'm using Bugsnag. |
Did you set bugsnag using this doc? https://docs.bugsnag.com/platforms/ruby/rack/ I ask this because I'll test using that |
Yes exactly. |
For now I can only check the code since I don't have my laptop with me. We set 'rack.exception' and bugsnag middleware should notify but I'll debug an application when I come back, thanks @cveneziani |
Thanks again. |
@cveneziani where did you define require './config/environment'
use Bugsnag::Rack
run Hanami.app |
9116f63
to
10786f7
Compare
I've defined the Bugsnag middleware in the I tried to move it within the Is it normal that it's not working (except for an error within an action) when the bug tracker is defined within the application? What if I want to enable Bugsnag middleware only from within a specific app as explained here: http://hanamirb.org/guides/1.1/actions/rack-integration/#application-middleware ? |
@cveneziani nop, it isn't normal and I'll try to fix that problem because as you said, you could add only in one app. |
Thanks for the clarification :) |
@cveneziani sorry for the late answer. In hanami 1.2.0 we support middlewares per application you will be able to add only bugsnag to one app or apps you want. I'll retest again this PR and make test passes. I'll come back to you shortly |
Nice to hear. Thanks again :) |
Set `handle_exceptions` to true by default
10786f7
to
46d5e8e
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@AlfonsoUceda This looks really good! 👏 💯
This PR fixes #865
It will render the 500 custom template if an exception happens in a view or template, in addition it sets
handle_exceptions
to true by default, in controller level it was true for not in hanami application level, https://github.com/hanami/hanami/blob/master/lib/hanami/application_configuration.rb#L1272