Skip to content

Instantly share code, notes, and snippets.

@coffeeaddict
Created October 19, 2009 07:07
Show Gist options
  • Save coffeeaddict/213177 to your computer and use it in GitHub Desktop.
Save coffeeaddict/213177 to your computer and use it in GitHub Desktop.
it does work
module Exceptions
# custom exceptions / errors with custom default messages a-go-go
# the base for defined errors.
class DefinedError < RuntimeError
@msg = "Undefined Defined Error"
def message
return @msg || super
end
end
class MileageError < DefinedError
def initialize(message = "The supplied mileage is invalid")
@msg = message
end
end
class DateError < DefinedError
def initialize(message = "The supplied date is invalid")
@msg = message
end
end
class FollowError < DefinedError
def initialize(message = "You cannot follow that car")
@msg = message
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment