It is important to understand the place of StandardError in the hierarchy of ruby exceptions:
The result of this code is:
This behavior is consistent with the way ruby exceptions are designed; Errors which you can generally deal with are subclassed from StandardError, while errors which indicate a failure in the semantic meaning of the code or its execution inherit directly from Exception
This gives us a list of exception classes:
Generally, if you are making your own exception class for non-fatal execution errors, you should inherit from StandardError or one of its descendants.
Leave a comment
Please note, comments must be formatted using Markdown. Links can be enclosed in angle brackets, e.g. <www.codeotaku.com>.