Hierarchy of Anvil-standard exceptions?

Is there a list of Anvil-standard exceptions somewhere? I’m writing code that should probably raise an exception, and I’d rather use a standard type, than reinvent one.

If I have to invent one, then I would likely follow this:

In which case, I should define my own app-specific branch of the exception hierarchy. Rooted at (for example) class AppError(anvil.server.AnvilWrappedError).

Could I then use AppError as a base class for the branch? Or must I derive each of my exceptions directly from anvil.server.AnvilWrappedError?

If I can use AppError as a base class, then are there any special considerations I would have to take into account in building, using, and/or catching the derived classes?

Defining your own app-specific exceptions is definitely the way to go. You can use whatever class hierarchy you like!

Which is what suggested the following questions:

And the answer to those those questions is, “You can use whatever class hierarchy you like”! There is no need to inherit directly from anvil.server.WrappedError.

1 Like

That’s great, @meredydd! I love keeping things simple!