How to raise and rescue Exceptions in Ruby on Rails
Posted by Bhushan Ahire | Posted in Rails, ruby | Posted on 09-05-2008
0
Creating the Exception class
To create our “PersonalException” we just need to extend “Exception” class.
class PersonalException < Exception
end
Raise our Exception
raise PersonalException.new, "message"
Rescue our exception
We can do this by overwriting rescue_action_in_public and local_request? functions to our application.rb file:
