how to handle Exceptions (Errors)

When an error happens in Python, an Exception is raised to stop the program, this means nothing past the line that caused the error will run.

It is useful because there is a problem that must be solved for the program to continue, and it is a problem when it causes the program to stop early.

What if I want the program to run even with errors? I might want to give messages to the user who does not care about or understand the details of the error.

Exception Handling is a way to deal with this, it allows programs to do something different when an error happens.


the chapters

Do you want to see all the CODE I typed in this chapter?

These tests show how to handle Errors(Exceptions) in tests and in programs


videos

  • How to test that an Exception is Raised

  • How to handle Exceptions in Programs


code from the chapters

Do you want to see all the CODE I typed in these chapters?


what is next?

Would you like to know how to test that an Exception is raised