I have been fighting with this for some hours now. I have a controller action that I want to render a page and then raise an exception automatically. I couldn't find much information on this that makes me think that I am looking for the wrong thing.
Is something like the below possible?
class UsersController < ActionController::Base
def new
# .. do stuff
begin
UserMailer::send_confirmation_link(@user)
rescue StandardError => e
render 'email_error'
raise(e)
end
# .. other stuff
end
end
In this case I simply want to inform the end-user of the error and then raise the exception on the application itself. Notice that I can't change the de-facto error page since this is a smaller application in the same codebase with a bigger application.