- I am using GrapeApi and I am using service design pattern so I need to handle exceptions outside the controller, but rescue_from is only working inside controllers. - I am using
rescue ExceptionNamein almost every method and I found that I am not respecting the DRY rule. so I created a fileservices/exception_handler_service.rb. and triedinclude ActiveSupport::Rescuableand it's just being ignored andextend ActiveSupport::Rescuableand throwing undefined method rescue_from.
is there a way I can use rescue_from outside the controller?
Here example for you in plain Ruby as idea using
rescue_with_handler