aop - Using Unity 2.0 handle exception -


when use unity 2.0 handle exception, got problem, below:

public class tracebehavior : iinterceptionbehavior {     public ienumerable<type> getrequiredinterfaces()     {         return type.emptytypes;     }      public imethodreturn invoke(imethodinvocation input, getnextinterceptionbehaviordelegate getnext)     {         console.writeline(string.format("invoke method:{0}",input.methodbase.tostring()));         imethodreturn result = getnext()(input, getnext);         if (result.exception == null)         {             console.writeline("invoke successful!");         }         else          {             console.writeline(string.format("invoke faild, error: {0}", result.exception.message));             result.exception = null;         }         return result;     }      public bool willexecute { { return true; } } } 

i have set result.exception=null (it's meaning have resolved exception , need not throw again.)
however,it throw exception me.

that's not how works. don't set result.exception, instead return input.createmethodreturn(newreturnvalues).


Comments

Popular posts from this blog

php - What is the difference between $_SERVER['PATH_INFO'] and $_SERVER['ORIG_PATH_INFO']? -

fortran - Function return type mismatch -

queue - mq_receive: message too long -