create your own type of exception if you wanted to.
class BadDataException < RuntimeError end class Person def initialize(name) raise BadDataException, "No name present" if name.empty? end end
1. | Ruby exception hierarchy | ||
2. | if we create our own exception classes, they need to be subclasses of either class Exception or one of its descendants. |