-
Notifications
You must be signed in to change notification settings - Fork 351
Make exception handling policy configurable for CORS #147
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
Comments
Thanks for contacting us, @itrofimow, |
Yeah, this try/catch is capturing way too much: AspNetWebStack/src/System.Web.Http.Cors/CorsMessageHandler.cs Lines 50 to 64 in b32ab42
It would be one thing if it were only catching exceptions for its own logic, but it's also catching exceptions from any upstream handlers. Fixing it would have to be opt-in config to avoid breaking people. |
I'll look at this and see what the approach might look like. We can decide based on that… |
You guys are the best. |
Hey guys. Any recent activity on this? |
@dougbu, can you please share your findings here? |
Hi. |
@itrofimow we have been focused on other priorities. What's needed here is an extensibility point to more easily override or hook into Cors exception handling. I haven't looked closely but other approaches might also solve the issue. If you would like to give it a shot, feel free. Please open your PR early so that we can provide feedback on your design while it's a work in progress. |
Yeah, sure. Thanks |
@dougbu ping |
I've submitted a PR for this, could you please take a look at it? There's just a few non-breaking changes |
Hi, Did anyone have a chance to take a look at this? Maybe the labels for this should be updated since we already have a PR? Would be great to know timeline or at least priority for this |
I plan to look at #185 tomorrow or over the weekend. |
Many thanks @itrofimow! |
In project i am working at custom exception handling OwinMiddleware is used as first in the pipeline, which catches every exception thrown by application and maps it to httpResponse/statusCode based on some logic. We replace IExceptionHanlder with a handler that just rethrows , thus we have a single global exception hanlder(middleware). The problem arised when we tried to add CORS - its System.Web.Http.Cors.CorsMessageHandler.SendAsync swallows exeptions and processes them by its own logic and that just broke plenty of things.
We ended up with basically copy/paste of that Handler with SendAsync not catching everything, then we had to replace CorsMessageHanlder at HttpConfigurations.MessageHanlders after EnsureInitialized has been called and that looks pretty nasty.
So what i am asking for - is it possible to make that exception handling policy configurable?
Or did i miss something and it already is?
The text was updated successfully, but these errors were encountered: