amoghmishra-sl

Results 5 comments of amoghmishra-sl

Is there a workaround for this? I'd want to generate the error logs as a background task when there is a failure. Given the current feature, they aren't getting generated.

@NewLanded yeah, this would work as it has the "return" statement. If you add a background task in a scenario like this then it won't work. ``` @app.post("/send-notification/{email}") async def...

@JarroVGIT The latest example is not of a middleware and `BackgroundTasks` of FastAPI won't log the error because it wasn't "returned" but raised. As mentioned by @Kludex above, > It...

Np, this worked for me too because the code flow reached the "return" statement. Hence, the background task logged the error.