Get startedGet started for free

Handling exception hierarchies

Previously, you defined an Employee class with a method get_bonus() that raises a BonusError and a SalaryError depending on parameters. But the BonusError exception was inherited from the SalaryError exception. How does exception inheritance affect exception handling?

The Employee class has been defined for you. It has a minimal salary of 30000 and a maximal bonus amount of 5000.

This exercise is part of the course

Object-Oriented Programming in Python

View Course

Hands-on interactive exercise

Turn theory into action with one of our interactive exercises

Start Exercise