catch(Exception e) { Exception ex = new Exception("ID = 1",e); ErrorSignal.FromCurrentContext().Raise(ex); }
那么可以做到这一点:
ErrorSignal.FromCurrentContext().log("Hello I am testing Elmah");
ErrorSignal.FromCurrentContext().Raise(new NotSupportedException());
对于自定义消息,您可以创建自定义异常。
var customEx = new Exception("Hello I am testing Elmah",new NotSupportedException()); ErrorSignal.FromCurrentContext().Raise(customEx);