Error Handling

Exception classes and error handling utilities for the DASL client. These exceptions provide detailed information about various error conditions that can occur when interacting with DASL services.

exception dasl_client.errors.errors.ConflictError(resource, identifier, message)[source]

Bases: Exception

Simple exception wrapper for 409 errors returned from the API

Parameters:
  • resource (str)

  • identifier (str)

  • message (str)

__init__(resource, identifier, message)[source]
Parameters:
  • resource (str)

  • identifier (str)

  • message (str)

exception dasl_client.errors.errors.NotFoundError(identifier, message)[source]

Bases: Exception

Simple exception wrapper for 404 errors returned from the API

Parameters:
  • identifier (str)

  • message (str)

__init__(identifier, message)[source]
Parameters:
  • identifier (str)

  • message (str)

exception dasl_client.errors.errors.BadRequestError(message)[source]

Bases: Exception

Simple exception wrapper for 400 errors returned from the API

Parameters:

message (str)

__init__(message)[source]
Parameters:

message (str)

exception dasl_client.errors.errors.UnauthorizedError(message)[source]

Bases: Exception

Simple exception wrapper for 401 errors returned from the API

Parameters:

message (str)

__init__(message)[source]
Parameters:

message (str)

exception dasl_client.errors.errors.ForbiddenError(message)[source]

Bases: Exception

Simple exception wrapper for 403 errors returned from the API

Parameters:

message (str)

__init__(message)[source]
Parameters:

message (str)

dasl_client.errors.errors.handle_errors(f)[source]

A decorator that handles errors returned from the API.

Parameters:

f (Callable) – the function that could return an API error

Return type:

Callable

Returns:

The output from the callable ‘f’. If an Api error was raise, re-cast it to a library error before re-raising.

dasl_client.errors.errors.error_handler()[source]

A context manager that handles errors returned from the API.

Within the context, if an API error is raised, it is re-cast to a library error before re-raising.

Error Handling Utilities

dasl_client.errors.errors.error_handler()[source]

A context manager that handles errors returned from the API.

Within the context, if an API error is raised, it is re-cast to a library error before re-raising.

dasl_client.errors.errors.handle_errors(f)[source]

A decorator that handles errors returned from the API.

Parameters:

f (Callable) – the function that could return an API error

Return type:

Callable

Returns:

The output from the callable ‘f’. If an Api error was raise, re-cast it to a library error before re-raising.