Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exception causes are being removed. #1129

Closed
loweryjk opened this issue Jan 20, 2021 · 2 comments
Closed

Exception causes are being removed. #1129

loweryjk opened this issue Jan 20, 2021 · 2 comments

Comments

@loweryjk
Copy link

I have code raising an exception from another exception.

try:
    return check_response(response)
except KeyError as exc:
    raise Exception('Failed to fetch the data.') from exc

I then have an exception handler.

@app.exception_handler(Exception)
async def exception(request: Request, exc: Exception):
    logger.info(exc)
    if exc.__cause__ is not None:
        logger.info(exc.__cause__)
    return self._json_response(HTTPStatus.INTERNAL_SERVER_ERROR, exc)

The second log statement never executes.

See this ticket for further details: fastapi/fastapi#2683

@oTree-org
Copy link
Contributor

I think this is the same as this issue: #1114

@JayH5
Copy link
Member

JayH5 commented Apr 12, 2021

Yeah this should be fixed by #1158

@JayH5 JayH5 closed this as completed Apr 12, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants