Exercise
Identify any code that can benefit from exception handling. For example, create a new HutError
exception, and use it to raise errors related to the Hut
class. Here is a cheat sheet:
Instead of using error_dict
, you can also create subclasses, such as:
class HutNumberGreaterThanFiveError(HutError): pass class NegativeHutNumberError(HutError): pass