PyAI Learn Türkçe

Module 8

Error handling

tracebacks, try/except, your own tests

When you finish this module you can say:

I can read an error, keep my program running without crashing, and write my own tests.

By the end of this module you'll be able to write a data reader that never crashes: it skips malformed rows and reports how many it skipped.

Start

Lessons

7 lessons · ≈ 67 min

  1. Reading a traceback8 min
  2. try and except9 min
  3. Catching the right error9 min
  4. Raising your own errors9 min
  5. Write the test first11 min
  6. Debugging: shrink and isolate9 min
  7. Project: Robust data reader12 min · project

Practice exercises

Short writing exercises, independent of the lessons: Go to the exercises

  1. The first bad text's message
  2. Two errors, one finally
  3. Raise on a wrong rate
  4. Skip one, reverse it
  5. A sturdy adder