-
Notifications
You must be signed in to change notification settings - Fork 138
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
Add section for exception handling #139
Add section for exception handling #139
Conversation
Why not use |
@brunoprietog : Thanks for the input. I have updated the PR. |
Nice! Now it looks much cleaner |
class ApplicationMailer < ActionMailer::Base | ||
ActionMailer::MailDeliveryJob.rescue_from(Exception) do |exception| | ||
Rails.error.report(exception) | ||
end |
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.
With this suggestion and the above, the job will succeed because the exception will be rescued. I think you don't want this in the majority of cases, you want your job to fail so you can inspect it and retry it.
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.
I have added the line to raise the exception.
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.
This looks good but I think we should re-raise the exception in both examples or people will have failing jobs succeed without an opportunity to examine or retry them.
Also... I need to look a bit deeper into this, but I'm not sure using |
@rosa : Good point. I too will have a look. |
@rosa : I have added the documentation as discussed in #120. Let me know your feedback.