c# - Global exception handler in Web API not getting called -
similar question asked here issue concerning 404 error.
i have added elmah global handler described here. if raise error in code elmah catches fine, if have sql error ef via controller example, not caught - exception message returned in json 500 error.
according article there few cases exception can't caught case doesn't seem 1 of them.
can please explain why global error handler in webapi won't catch sql exception?
here's handler:
public class unhandledexceptionfilter : exceptionfilterattribute { public override void onexception(httpactionexecutedcontext context) { elmah.errorlog.getdefault(httpcontext.current).log(new elmah.error(context.exception)); } }
and here's it's registered in webapiconfig.cs
public static void register(httpconfiguration config) { ---- config.filters.add(new unhandledexceptionfilter()); }
Comments
Post a Comment