File: exceptions.py

package info (click to toggle)
python-pyproj 3.7.2-1~exp1
  • links: PTS, VCS
  • area: main
  • in suites: experimental
  • size: 1,728 kB
  • sloc: python: 13,453; sh: 273; makefile: 90
file content (28 lines) | stat: -rw-r--r-- 694 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
"""
Exceptions for pyproj
"""

from pyproj._context import _clear_proj_error, _get_proj_error


class ProjError(RuntimeError):
    """Raised when a Proj error occurs."""

    def __init__(self, error_message: str) -> None:
        proj_error = _get_proj_error()
        if proj_error is not None:
            error_message = f"{error_message}: (Internal Proj Error: {proj_error})"
            _clear_proj_error()
        super().__init__(error_message)


class CRSError(ProjError):
    """Raised when a CRS error occurs."""


class GeodError(RuntimeError):
    """Raised when a Geod error occurs."""


class DataDirError(RuntimeError):
    """Raised when a the data directory was not found."""