Source code for swh.scanner.exceptions

# Copyright (C) 2020  The Software Heritage developers
# See the AUTHORS file at the top-level directory of this distribution
# License: GNU General Public License version 3, or any later version
# See top-level LICENSE file for more information

from typing import Any, Optional


[docs] class InvalidObjectType(TypeError): pass
[docs] class InvalidDirectoryPath(Exception): pass
[docs] class LargePayloadExc(Exception): pass
[docs] class DBError(Exception): pass
[docs] class APIError(Exception): def __str__(self): return '"%s"' % self.args
[docs] def error_response(reason: Optional[Any], status_code: int, api_url: str): error_msg = f"{status_code} {reason}: '{api_url}'" raise APIError(error_msg)