TempleOS
Explore posts from servers❔ OnActionExecuted exception filter runs before exception is thrown and is never called
So I've found a bit more information about how the app is working. There was a custom class called
FileCallbackResult
inside of that class, it overwrites the ExecuteResultAsync
. This indicates that the code that I'm expecting to throw an error r.Result?.Invoke(responseBodyWriter.AsStream()) ?? Task.CompletedTask
at the result stage, but this explains why each of the other filter types would fail, and an exception filter didn't work either. The issue now is managing to get the error and handle the error before the response is sent to the client. This is an issue I am not sure how to solve.26 replies
❔ OnActionExecuted exception filter runs before exception is thrown and is never called
I removed the other filter as a test, no change, I modified to be an exception filter and still no change. The stack trace has some information, but still doesn't quite help me solve the core issue. The stack trace ends at the
downloadCommand
step.26 replies
❔ OnActionExecuted exception filter runs before exception is thrown and is never called
Do you mind explaining this a bit further. The concept of different pipelines? It seems strange that if I throw the exception directly in the controller (just immediately, not in the same fashion as shown above), that it doesn't bubble to the other filter implementation.
You might have also configured exception handling elsewhere that prevents your filter from getting itI'm kind of doubting it, but it's not impossible. It's a large app, but idk
26 replies
❔ OnActionExecuted exception filter runs before exception is thrown and is never called
So I found a bit of an issue. I tried testing out throwing the error in the controller directly and it worked. However, the actual code passes through three layers.
httpService -> documentGenerator -> downloadCommand -> controller
All while the http service passes a stream down, and each layer passes the stream. So, it's almost as if /api
doesn't ever get the thrown exception in this process. Which is strange to me.26 replies