Skip to content

Fix logging in exception handlers #364

@geospatial-jeff

Description

@geospatial-jeff

The exc_info=True parameter in the exception handlers doesn't actually do anything because the log statement isn't within a except block. It should either be removed or updated to explicitly pass in exception traceback so it is logged:

exc = Exception
logger.error(
    "My error message",
    exc_info=(type(exc), exc, exc.__traceback__)
)

Logging every exception that triggers a handler might be overkill, we may just want to log traceback on 5XX responses?

https://github.com/stac-utils/stac-fastapi/blob/master/stac_fastapi/api/stac_fastapi/api/errors.py#L45

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions