Source code for AutomateTheBoringStuff.Ch10.P2_errorExample

"""Error Example

This program raises an exception and automatically displays the traceback.

"""


[docs]def spam() -> None: """Spam Calls :meth:`bacon`. Returns: None. """ bacon()
[docs]def bacon() -> None: """Bacon Raises base exception. Returns: None. Raises: Exception: Always """ raise Exception("This is the error message.")
[docs]def main(): spam()
if __name__ == '__main__': main()