#100DaysOfCode in Python Transcripts
Chapter: Days 25-27: Error handling
Lecture: Introducing Python's error handling
Login or
purchase this course
to watch this video and the rest of the course contents.
0:00
Probably time that we talked about error handling. I'm sure that you've encountered some issues with your Python code and you may wonder
0:09
what is the right way to catch these errors in Python. Well, that's what this next three day section is all about.
0:17
Have you encountered Python's errors? Have you seen what's called a traceback here? This is the report from trying to run the Python program
0:26
when something actually went wrong on line 21 of api.py. Let me get a little info here, there's a type error : and this
0:35
gives us a description of what that is. The type thing on the left here, the type error is an exception type and it tells us the category of error.
0:42
On the right is the actual message of what went wrong within that category. So None type, object is not iterable.
0:49
Turns out that in this case, the data return from the server was empty and we tried to loop over it. That doesn't work so well.
0:56
So we're going to see how to deal with a variety of errors the proper way in Python.