maestral.errorhandling#

This module contains methods and decorators to convert OSErrors and Dropbox SDK exceptions to instances of maestral.exceptions.MaestralApiError.

Module Contents#

maestral.errorhandling.CONNECTION_ERRORS = ()[source]#
maestral.errorhandling.convert_api_errors(dbx_path=None, local_path=None)[source]#

A context manager that catches and re-raises instances of OSError and dropbox.exceptions.DropboxException as maestral.exceptions.MaestralApiError or ConnectionError.

Parameters:
  • dbx_path (str | None) – Dropbox path associated with the error.

  • local_path (str | None) – Local path associated with the error.

Return type:

Iterator[None]

maestral.errorhandling.os_to_maestral_error(exc, dbx_path=None, local_path=None)[source]#

Converts a OSError to a maestral.exceptions.MaestralApiError and tries to add a reasonably informative error title and message.

Parameters:
  • exc (OSError) – Original OSError.

  • dbx_path (str | None) – Dropbox path associated with the error.

  • local_path (str | None) – Local path associated with the error.

Returns:

Converted exception.

Return type:

LocalError

maestral.errorhandling.dropbox_to_maestral_error(exc, dbx_path=None, local_path=None)[source]#

Converts a Dropbox SDK exception to a maestral.exceptions.MaestralApiError and tries to add a reasonably informative error title and message.

Parameters:
Returns:

Converted exception.

Return type:

maestral.exceptions.MaestralApiError