Source code for pyworldatlas.exceptions

"""Errors PyWorldAtlas raises, all subclasses of :class:`AtlasError`.

Catch :class:`AtlasError` to handle any atlas problem in one place, or a
specific error such as :class:`CountryNotFoundError`. Lookup errors explain
what went wrong and suggest close spellings ("Did you mean Japan?").
"""


[docs] class AtlasError(Exception): """Base class for atlas errors."""
[docs] class AtlasClosedError(AtlasError): """Raised when a closed atlas is used."""
[docs] class DatasetError(AtlasError): """Base class for bundled-dataset errors."""
[docs] class DatasetNotFoundError(DatasetError): """Raised when the bundled SQLite database cannot be found."""
[docs] class DatasetVersionError(DatasetError): """Raised when runtime and dataset schema versions disagree."""
[docs] class DatasetIntegrityError(DatasetError): """Raised when the bundled dataset fails an integrity check."""
[docs] class CountryNotFoundError(AtlasError, LookupError): """Raised when a country query has no exact match."""
[docs] class AmbiguousCountryError(AtlasError, LookupError): """Raised when an exact country name identifies multiple profiles."""
[docs] class PlaceNotFoundError(AtlasError, LookupError): """Raised when a place query has no match."""
[docs] class AmbiguousPlaceError(AtlasError, LookupError): """Raised when a place query is ambiguous."""
[docs] class CapitalNotFoundError(PlaceNotFoundError): """Raised when a capital query has no match."""
[docs] class MapSupportNotInstalledError(AtlasError): """Raised when an optional map viewer or map-data pack is unavailable."""
[docs] class PackNotInstalledError(AtlasError): """Raised when a feature needs an optional data pack that is not installed. The message names the ``pyworldatlas get`` command that installs it. """