exceptions

Application exceptions

exception types.

Also, defines functions that translate service and repository exceptions into HTTP exceptions.

exception src.server.lib.exceptions.AuthorizationError[source]

Bases: ApplicationClientError

A user tried to do something they shouldn’t have.

exception src.server.lib.exceptions.HealthCheckConfigurationError[source]

Bases: ApplicationError

An error occurred while registering a health check.

exception src.server.lib.exceptions.MissingDependencyError(module: str, config: str | None = None)[source]

Bases: ApplicationError, ValueError

A required dependency is not installed.

Missing Dependency Error.

Parameters:
  • module – name of the package that should be installed

  • config – name of the extra to install the package.

__init__(module: str, config: str | None = None) None[source]

Missing Dependency Error.

Parameters:
  • module – name of the package that should be installed

  • config – name of the extra to install the package.

exception src.server.lib.exceptions.ApplicationError[source]

Bases: Exception

Base exception type for the lib’s custom exception types.

async src.server.lib.exceptions.after_exception_hook_handler(exc: Exception, _scope: Scope) None[source]

Binds exc_info key with exception instance as value to structlog context vars.

Note

This must be a coroutine so that it is not wrapped in a thread where we’ll lose context.

Parameters:
  • exc – the exception that was raised.

  • _scope – scope of the request