Skip to main content

Practice ยท 1 of 2

App Exception Family

Define AppError(Exception), ValidationError(AppError), and NotFoundError(AppError). Then implement get_item(items: dict, key) that raises NotFoundError (message must contain the key) for missing keys and returns the value otherwise.

Difficulty: intermediate

Back to lesson: Practice: Exception Hierarchy Drills