c# - MVC4 ExceptionContext ExceptionHandled Property no try catch block ELMAH -
i trying install , test elmah fist time. think have setup correctly. know elmah designed log unhandled exceptions. use standard template mvc 4 application generated visual studio 2012
in homecontroler class throw error without try , catch block
public actionresult about() { // throw test error can see handled elmah // test go ~/elmah.axd page see if error being logged correctly throw new exception("a test exception elmah"); return view(); }
in opinion unhandled exception.
further use handleerrorwithelmahattribute class handle error. construct shown in many elmah tutorials posted here:
how elmah work asp.net mvc [handleerror] attribute?
the code bothers me is:
public override void onexception(exceptioncontext context) { base.onexception(context); var e = context.exception; if (!context.exceptionhandled // if unhandled, logged anyhow || raiseerrorsignal(e) // prefer signaling, if possible || isfiltered(context)) // filtered? return; logexception(e); }
in if statement property contect.exceptionhanled checked. property set true, thrown error not logged.
can explain why set true while there no try-catch.
best regards, sebastian
Comments
Post a Comment