A program has two exception classes of its own, one inheriting from the other.
class AppError(Exception):
pass
class SaveError(AppError):
pass
def save(n):
if n < 0:
raise SaveError("negative")
return n
for n in (2, -1):
try:
print(save(n), end=" ")
except AppError as e:
print(type(e).__name__, e)
except SaveError:
print("save")
What does the program print?