class AlbumException(Exception): ... class AlbumNotFoundError(AlbumException): def __init__(self): self.status_code = 404 self.detail = "Album Not Found" class AlbumAlreadyExistError(AlbumException): def __init__(self): self.status_code = 409 self.detail = "Album Already Exists"