stac-fastapi
stac-fastapi copied to clipboard
Fix logging in exception handlers
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