Skip to content

Instantly share code, notes, and snippets.

@matan23
Created October 11, 2013 11:55
Show Gist options
  • Save matan23/6933471 to your computer and use it in GitHub Desktop.
Save matan23/6933471 to your computer and use it in GitHub Desktop.
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!'})
@matan23
Copy link
Author

matan23 commented Oct 11, 2013

Error management + instruction to execute

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment