Skip to content

Commit

Permalink
add error handler
Browse files Browse the repository at this point in the history
  • Loading branch information
vincentsarago committed Feb 11, 2024
1 parent 5e4f72c commit 42fcd43
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions titiler/cmr/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,12 @@
from starlette.templating import Jinja2Templates

from titiler.cmr import __version__ as titiler_cmr_version
from titiler.cmr.errors import DEFAULT_STATUS_CODES as CMR_STATUS_CODES
from titiler.cmr.factory import Endpoints
from titiler.cmr.settings import ApiSettings, AuthSettings
from titiler.core.errors import DEFAULT_STATUS_CODES, add_exception_handlers
from titiler.core.middleware import CacheControlMiddleware, LoggerMiddleware
from titiler.mosaic.errors import MOSAIC_STATUS_CODES

jinja2_env = jinja2.Environment(
loader=jinja2.ChoiceLoader(
Expand Down Expand Up @@ -56,6 +59,9 @@ async def lifespan(app: FastAPI):
lifespan=lifespan,
)

add_exception_handlers(app, DEFAULT_STATUS_CODES)
add_exception_handlers(app, MOSAIC_STATUS_CODES)
add_exception_handlers(app, CMR_STATUS_CODES)

# Set all CORS enabled origins
if settings.cors_origins:
Expand Down

0 comments on commit 42fcd43

Please sign in to comment.