errors
stac_fastapi.api.errors ¶
Error handling.
ErrorResponse ¶
Bases: TypedDict
A JSON error response returned by the API.
The STAC API spec expects that code
and description
are both present in
the payload.
Attributes:
-
code
(str
) –A code representing the error, semantics are up to implementor.
-
description
(str
) –A description of the error.
Source code in stac_fastapi/api/errors.py
35 36 37 38 39 40 41 42 43 44 45 46 47 |
|
add_exception_handlers ¶
Add exception handlers to the FastAPI application.
Parameters:
-
app
(FastAPI
) –the FastAPI application.
-
status_codes
(Dict[Type[Exception], int]
) –mapping between exceptions and status codes.
Returns:
-
None
–None
Source code in stac_fastapi/api/errors.py
71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 |
|
exception_handler_factory ¶
Create a FastAPI exception handler for a particular status code.
Parameters:
-
status_code
(int
) –HTTP status code.
Returns:
-
callable
(Callable
) –an exception handler.
Source code in stac_fastapi/api/errors.py
50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 |
|