Created
October 19, 2009 07:07
-
-
Save coffeeaddict/213177 to your computer and use it in GitHub Desktop.
it does work
This file contains 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
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