You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am currently catching all errors and sending an email on error like this
Sidekiq.configure_server do |config|
config.error_handlers << proc do |ex, context, config|
Rails.logger.error ex
Rails.logger.error context
Rails.logger.error config
ErrorMailer.with(exception: ex.to_s, context: context.to_s).sidekiq.deliver_later
end
end
My problem is that if the email can't be delivered (e.g. mail server not available) the ErrorMailer also throws an error which again sends an email and so on.
I already saw that inside the context, there is the name of the ErrorMailer that I can use to not sending an email. But are there any better options e.g. tell sidekiq not to throw an error for this type of mailer or somehow catch the exception for this mailer inside the mailer model? Maybe not sending an email at all and send the email somewhere else? Or use deliver_now and listen for exception?
The cleanest way would probably be not sending the email but sending the error to some other tool instead and let that tool handle the email. But we currently do not have that option.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
I am currently catching all errors and sending an email on error like this
My problem is that if the email can't be delivered (e.g. mail server not available) the ErrorMailer also throws an error which again sends an email and so on.
I already saw that inside the context, there is the name of the ErrorMailer that I can use to not sending an email. But are there any better options e.g. tell sidekiq not to throw an error for this type of mailer or somehow catch the exception for this mailer inside the mailer model? Maybe not sending an email at all and send the email somewhere else? Or use deliver_now and listen for exception?
The cleanest way would probably be not sending the email but sending the error to some other tool instead and let that tool handle the email. But we currently do not have that option.
Any ideas are welcome.
Beta Was this translation helpful? Give feedback.
All reactions