How to use the maestral.sync.errors.MaestralApiError function in maestral

To help you get started, we’ve selected a few maestral examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github SamSchott / maestral-dropbox / maestral / sync / errors.py View on Github external
if ("The given OAuth 2 access token is malformed" in exc.message or
                "Invalid authorization value in HTTP header" in exc.message):
            title = "Authentication failed"
            text = "Please make sure that you entered the correct authentication code."
            err_type = DropboxAuthError
        else:
            title = "Dropbox error"
            text = exc.message
            err_type = BadInputError

    # -------------------------- Everything else -----------------------------------------
    else:
        title = exc.args[0]
        text = None

    return err_type(title, text, dbx_path=dbx_path, local_path=local_path)
github SamSchott / maestral-dropbox / maestral / sync / errors.py View on Github external
def _get_lookup_error_msg(lookup_error):

    text = None
    err_type = MaestralApiError

    if lookup_error.is_malformed_path():
        text = ("The destination path is invalid. Paths may not end with a slash or "
                "whitespace.")
        err_type = PathError
    elif lookup_error.is_not_file():
        text = "We were expecting a file, but the given path refers to a folder."
        err_type = PathError
    elif lookup_error.is_not_folder():
        text = "We were expecting a folder, but the given path refers to a file."
        err_type = PathError
    elif lookup_error.is_not_found():
        text = "There is nothing at the given path."
        err_type = PathError
    elif lookup_error.is_restricted_content():
        text = ("The file cannot be transferred because the content is restricted. For "
github SamSchott / maestral-dropbox / maestral / sync / errors.py View on Github external
"""Raised when there is an issue with the provided file / folder path. Refer to the
    ``message``` attribute for details."""
    pass


class ExcludedItemError(MaestralApiError):
    """Raised when an item which is excluded form syncing is created locally."""
    pass


class DropboxServerError(MaestralApiError):
    """Raised in case of internal Dropbox errors."""
    pass


class RestrictedContentError(MaestralApiError):
    """Raised for instance when trying add a file with a DMCA takedown notice to a
    public folder."""
    pass


class DropboxAuthError(MaestralApiError):
    """Raised when authentication fails. Refer to the ``message``` attribute for
    details."""
    pass


class TokenExpiredError(DropboxAuthError):
    """Raised when authentication fails because the user's token has expired."""
    pass
github SamSchott / maestral-dropbox / maestral / sync / monitor.py View on Github external
# notify user about changes
                        if CONF.get("app", "notifications"):
                            sync.notify_user(changes)

                        # apply remote changes to local Dropbox folder
                        sync.apply_remote_changes(changes)

                        logger.info(IDLE)

        except ConnectionError:
            syncing.clear()
            connected.clear()
            disconnected_signal.send()
            logger.debug(DISCONNECTED, exc_info=True)
            logger.info(DISCONNECTED)
        except MaestralApiError as e:
            syncing.clear()  # stop syncing
            running.clear()  # shutdown threads
            logger.error(e.title, exc_info=True)
        except Exception:
            logger.error("Unexpected error", exc_info=True)
github SamSchott / maestral-dropbox / maestral / sync / errors.py View on Github external
"""Raised when an item which is excluded form syncing is created locally."""
    pass


class DropboxServerError(MaestralApiError):
    """Raised in case of internal Dropbox errors."""
    pass


class RestrictedContentError(MaestralApiError):
    """Raised for instance when trying add a file with a DMCA takedown notice to a
    public folder."""
    pass


class DropboxAuthError(MaestralApiError):
    """Raised when authentication fails. Refer to the ``message``` attribute for
    details."""
    pass


class TokenExpiredError(DropboxAuthError):
    """Raised when authentication fails because the user's token has expired."""
    pass


class BadInputError(MaestralApiError):
    """Raised when an API request is made with bad input. This should not happen
    during syncing but only in case of manual API calls."""
    pass
github SamSchott / maestral-dropbox / maestral / sync / errors.py View on Github external
both locally and on Dropbox servers."""
    pass


class InsufficientSpaceError(MaestralApiError):
    """Raised when the Dropbox account has insufficient storage space."""
    pass


class PathError(MaestralApiError):
    """Raised when there is an issue with the provided file / folder path. Refer to the
    ``message``` attribute for details."""
    pass


class ExcludedItemError(MaestralApiError):
    """Raised when an item which is excluded form syncing is created locally."""
    pass


class DropboxServerError(MaestralApiError):
    """Raised in case of internal Dropbox errors."""
    pass


class RestrictedContentError(MaestralApiError):
    """Raised for instance when trying add a file with a DMCA takedown notice to a
    public folder."""
    pass


class DropboxAuthError(MaestralApiError):
github SamSchott / maestral-dropbox / maestral / sync / errors.py View on Github external
"""Raised when the rev file exists but cannot be read."""
    pass


class InsufficientPermissionsError(MaestralApiError):
    """Raised when writing a file / folder fails due to insufficient permissions,
    both locally and on Dropbox servers."""
    pass


class InsufficientSpaceError(MaestralApiError):
    """Raised when the Dropbox account has insufficient storage space."""
    pass


class PathError(MaestralApiError):
    """Raised when there is an issue with the provided file / folder path. Refer to the
    ``message``` attribute for details."""
    pass


class ExcludedItemError(MaestralApiError):
    """Raised when an item which is excluded form syncing is created locally."""
    pass


class DropboxServerError(MaestralApiError):
    """Raised in case of internal Dropbox errors."""
    pass


class RestrictedContentError(MaestralApiError):
github SamSchott / maestral-dropbox / maestral / sync / errors.py View on Github external
self.message = message
        self.dbx_path = dbx_path
        self.dbx_path_dst = dbx_path_dst
        self.local_path = local_path
        self.local_path_dst = local_path_dst

    def __str__(self):
        return "'{0}': {1}. {2}".format(self.dbx_path, self.title, self.message)


class RevFileError(MaestralApiError):
    """Raised when the rev file exists but cannot be read."""
    pass


class InsufficientPermissionsError(MaestralApiError):
    """Raised when writing a file / folder fails due to insufficient permissions,
    both locally and on Dropbox servers."""
    pass


class InsufficientSpaceError(MaestralApiError):
    """Raised when the Dropbox account has insufficient storage space."""
    pass


class PathError(MaestralApiError):
    """Raised when there is an issue with the provided file / folder path. Refer to the
    ``message``` attribute for details."""
    pass
github SamSchott / maestral-dropbox / maestral / sync / errors.py View on Github external
def __str__(self):
        return "'{0}': {1}. {2}".format(self.dbx_path, self.title, self.message)


class RevFileError(MaestralApiError):
    """Raised when the rev file exists but cannot be read."""
    pass


class InsufficientPermissionsError(MaestralApiError):
    """Raised when writing a file / folder fails due to insufficient permissions,
    both locally and on Dropbox servers."""
    pass


class InsufficientSpaceError(MaestralApiError):
    """Raised when the Dropbox account has insufficient storage space."""
    pass


class PathError(MaestralApiError):
    """Raised when there is an issue with the provided file / folder path. Refer to the
    ``message``` attribute for details."""
    pass


class ExcludedItemError(MaestralApiError):
    """Raised when an item which is excluded form syncing is created locally."""
    pass


class DropboxServerError(MaestralApiError):
github SamSchott / maestral-dropbox / maestral / sync / errors.py View on Github external
public folder."""
    pass


class DropboxAuthError(MaestralApiError):
    """Raised when authentication fails. Refer to the ``message``` attribute for
    details."""
    pass


class TokenExpiredError(DropboxAuthError):
    """Raised when authentication fails because the user's token has expired."""
    pass


class BadInputError(MaestralApiError):
    """Raised when an API request is made with bad input. This should not happen
    during syncing but only in case of manual API calls."""
    pass


class CursorResetError(MaestralApiError):
    """Raised when the cursor used for a longpoll or list-folder request has been
    invalidated. Dropbox should very rarely invalidate a cursor. If this happens, a new
    cursor for the respective folder has to be obtained through files_list_folder. This
    may require re-syncing the entire Dropbox."""
    pass


class UnsupportedFileError(MaestralApiError):
    """Raised when this file type cannot be downloaded but only exported. This is the
    case for G-suite files, e.g., google sheets on Dropbox cannot be downloaded but