I would like to be able to publish to SNS topic(s) on exceptions.
Is there a way to capture all exceptions on the way out of the controller…is there something like the rescue_from I’ve read briefly about or can I accomplish something similar with an after_action
As always, thanks for the patience…not a ruby guy so I could very well be asking stoopid questions…that said, any help would be greatly appreciated.
To add more clarity. So there’s no rescue_from currently.
Currently, you have to create a Turbine. Turbines are one way to extend Jets. Here’s an example (untested):
lib/my_turbine.rb:
class MyTurbine < ::Jets::Turbine
on_exception 'my_turbine.capture' do |exception|
# my exception handing code
end
end
config/initializers/my_turbine.rb:
require_relative "lib/my_turbine.rb"
Note, this handles all exceptions: controllers, jobs, etc. Will have to look into adding something like a rescue_from in time as it’s easier than creating a Turbine.
I must be doing something wrong…I’ve tried both sentry-jets and honeybadger-jets with no luck…
I then tried the MyTurbine example above and in none of the cases do I ever seem to land in on_exception. initializer happens as expected but not on_exception . I’ve attempted raise and throw but have been unsuccessful.
I’ve done no other initialization other creating config/initializers/my_turbine.rb . Is there a step I am missing?
As always, thanks for the quick response…I’m back up and running. Sorry, I didn’t try to capture in a deployed environment before posting…that said, having a way to play with it locally is always a good thing.