Created
October 11, 2013 11:55
-
-
Save matan23/6933471 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class MyException < StandardError | |
def initialize(args, action_to_take) | |
#message d'erreur | |
puts 'hehe' | |
#on redirige ou render ou autres.. | |
action_to_take.call | |
end | |
end | |
def foo | |
yield | |
end | |
#cas 1 | |
raise MyException.new('hehe', Proc.new{puts 'redirigeons vers home!'}) | |
#cas 2 | |
raise MyException.new('hehe', Proc.new{puts 'render form!'}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Error management + instruction to execute