Chapter 7. Errors and Exceptions
Terms in This Chapter
Call stack
Catchall bucket, exception handler
catch statement
Class-based exception
else clause
Error
except clause
Exception
Exception class
Exception handling
finally clause
Granularity
Most to least specific order
raise statement
Throwing versus raising
try block
try statement
Suite
User-defined versus built-in exception
Bad things happen to good programs: Disks crash, files are corrupted, and batteries fail. Such things are typically more the exception than the rule, and to plan for all of them would make for some very complicated code. That's why modern programming languages like Python have the ability to handle bad things, called exceptions in programming speak.
The old way of dealing with errors was ...
Get Python Programming with the Java™ Class Libraries: A Tutorial for Building Web and Enterprise Applications with Jython now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.