#100DaysOfCode in Python Transcripts
Chapter: Days 25-27: Error handling
Lecture: Your turn: Day 2
0:00 Day 2, your goal is to discover all the
0:02 error conditions that you might need to catch,
0:05 and actually determine the exception type that
0:08 that results in, in Python.
0:10 Are you working with something that talks to a database?
0:12 What kind of errors could you get from the database?
0:15 Are you talking to something that goes across the network?
0:18 What type of errors come across, from say, the
0:20 network being down or DNS not working,
0:22 or the network being on,
0:24 but not being able to reach the host,
0:26 all those sorts of things.
0:28 So come up with that list,
0:29 and figure out what type,
0:31 what actual exception type in Python does it surface as.
0:35 All right, if it's a connection error it could be
0:37 something built into the standard library,
0:38 or it could be something in say, requests,
0:41 as we saw in our example.
0:42 So, you're going to have know exactly what those types are
0:44 so that you can actually write the
0:46 probably error handling code.
0:47 That's it for today,
0:49 it might be a little bit tricky to get your app
0:51 into all the different situations that it's going
0:53 to encounter, all right?
0:55 Some of these errors are hard to trigger,
0:56 but do your best to figure out all the various
0:58 error cases you're going to run into.