avwx.exceptions

Contains avwx custom exceptions.

 1"""Contains avwx custom exceptions."""
 2
 3
 4def exception_intercept(exception: Exception, **extra: dict) -> None:  # noqa: ARG001
 5    """Interceptor to overwrite unhandled exceptions in high-failure locations."""
 6    raise exception
 7
 8
 9class BadStation(Exception):
10    """Station does not exist."""
11
12
13class InvalidRequest(Exception):
14    """Unable to fetch data."""
15
16
17class SourceError(Exception):
18    """Source servers returned an error code."""
19
20
21class MissingExtraModule(ModuleNotFoundError):
22    """Inform user that an extra install module is needed."""
23
24    def __init__(self, extra: str):
25        super().__init__(f"Install avwx-engine[{extra}] to use this feature")
def exception_intercept(exception: Exception, **extra: dict) -> None:
5def exception_intercept(exception: Exception, **extra: dict) -> None:  # noqa: ARG001
6    """Interceptor to overwrite unhandled exceptions in high-failure locations."""
7    raise exception

Interceptor to overwrite unhandled exceptions in high-failure locations.

class BadStation(builtins.Exception):
10class BadStation(Exception):
11    """Station does not exist."""

Station does not exist.

class InvalidRequest(builtins.Exception):
14class InvalidRequest(Exception):
15    """Unable to fetch data."""

Unable to fetch data.

class SourceError(builtins.Exception):
18class SourceError(Exception):
19    """Source servers returned an error code."""

Source servers returned an error code.

class MissingExtraModule(builtins.ModuleNotFoundError):
22class MissingExtraModule(ModuleNotFoundError):
23    """Inform user that an extra install module is needed."""
24
25    def __init__(self, extra: str):
26        super().__init__(f"Install avwx-engine[{extra}] to use this feature")

Inform user that an extra install module is needed.

MissingExtraModule(extra: str)
25    def __init__(self, extra: str):
26        super().__init__(f"Install avwx-engine[{extra}] to use this feature")