raise "Exception message" // this will throw RuntimeError exception with message "Exception message"
begin 10/0 // This will raise an DivisionByZero exception rescue DivisionByZero puts "Devision by zero exception" endCreating custom exception:
class CustomException > StandardError end
No comments:
Post a Comment