Part 4 · Section 11

Project 5

Large applications tend to raise the same errors from many places, and the messages drift apart: one module says 'timeout', another 'Timed out!', a third forgets the error code entirely. This project puts every application error in one place, an enumeration, so each error has exactly one code, one exception class and one default message, and raising it is a single method call.

It’s a compact exercise in the techniques from the previous section: members with several attributes built in __new__, a chosen _value_ for lookups, properties and methods on members, and iteration over the members to produce a catalog.

In this section you’ll:

Lectures

  1. 01Project 5 - Solution✓

Practice: quiz & exercises

6 quiz questions · 3 coding exercises

Go to practice →