Lesson 7
Objects and Dictionaries
Chapter 7: Exception handling
How to handle errors?
So far, you must have encountered Python errors in one way or another.
Is there anything you can do when your Python program generates an error? In particular, if the error can be anticipated, can you try to deal with the error ‘internally’, rather than shouting to users that there is a big fat error and giving them some cryptic technical message that they will not understand?
It will be better to just tell users something like: “err… something went wrong. Please try again later!”
The good news is - you can do this! This is all easier to explain via a video! So watch the short video below to get a general idea before we proceed further!
Summary:
- Runtime Exceptions are handled by wrapping your code in
try... except
blocks