Source code for iiisight.errors
"""Exception types raised by iiisight.
Tolerance covers *document* imperfection — a malformed manifest is repaired and
reported via diagnostics, never raised. Genuine failures of the *transport* (a
404, a connection error, a non-JSON body) and caller-contract violations (asking
``fetch_manifest`` for a URL that resolves to a Collection) are exceptional and
raise these types.
"""
[docs]
class IIISightError(Exception):
"""Base class for all errors raised by iiisight."""
[docs]
class FetchError(IIISightError):
"""A document could not be retrieved or decoded.
Attributes:
url: The URL that was being fetched.
"""
def __init__(self, url: str, message: str):
self.url = url
super().__init__(f"failed to fetch {url}: {message}")
[docs]
class UnexpectedDocumentError(IIISightError):
"""A fetched document was not of the type the caller asked for."""
[docs]
class ImageServiceNotLoaded(IIISightError):
"""A tile/region operation needs an ImageService populated by ``load_info()``."""
[docs]
class UnknownScaleFactor(IIISightError):
"""A tile was requested at a scale factor the service does not advertise."""