File: exceptions.py

package info (click to toggle)
pystac-client 0.9.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 47,416 kB
  • sloc: python: 4,652; sh: 74; makefile: 60
file content (17 lines) | stat: -rw-r--r-- 417 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
from requests import Response


class APIError(Exception):
    """Raised when unexpected server error."""

    status_code: int | None

    @classmethod
    def from_response(cls, response: Response) -> "APIError":
        error = cls(response.text)
        error.status_code = response.status_code
        return error


class ParametersError(Exception):
    """Raised when invalid parameters are used in a query"""