protected override void invoke(Action action) { _logger.DebugMessage(() => new BehaviorStart(_correlation)); try { action(); _logger.DebugMessage(() => new BehaviorFinish(_correlation)); } catch (Exception ex) { if (!_exceptionObserver.WasObserved(ex)) { _logger.DebugMessage(() => { var log = new BehaviorFinish(_correlation); log.LogException(ex); return(log); }); _exceptionObserver.RecordHandled(ex); } throw; } }
protected override void invoke(Action action) { _logger.DebugMessage(() => new BehaviorStart(_correlation)); try { action(); _logger.DebugMessage(() => new BehaviorFinish(_correlation)); } catch (UnhandledFubuException) { throw; } catch (Exception ex) { _logger.DebugMessage(() => { var log = new BehaviorFinish(_correlation); log.LogException(ex); return log; }); throw new UnhandledFubuException("Behavior failed", ex); } }
protected override void invoke(Action action) { _logger.DebugMessage(() => new BehaviorStart(_correlation)); try { action(); _logger.DebugMessage(() => new BehaviorFinish(_correlation)); } catch (Exception ex) { if (!_exceptionObserver.WasObserved(ex)) { _logger.DebugMessage(() => { var log = new BehaviorFinish(_correlation); log.LogException(ex); return log; }); _exceptionObserver.RecordHandled(ex); } throw; } }
public void visualize_BehaviorFinish_with_no_exceptions() { var finish = new BehaviorFinish(new BehaviorCorrelation(new FakeNode())); var tag = new BehaviorStartAndFinishEndpoints().VisualizePartial(finish); tag.Children.Any(x => x.HasClass("exception")).ShouldBeFalse(); tag.Next.ShouldBeNull(); }
public void is_successful_after_capturing_an_exception() { var correlation = new BehaviorFinish(new BehaviorCorrelation(new FakeNode())); var ex = new NotImplementedException("What?"); correlation.LogException(ex); correlation.Succeeded.ShouldBeFalse(); correlation.Exception.ShouldNotBeNull(); }
public void visualize_BehaviorFinish_with_an_exception() { var finish = new BehaviorFinish(new BehaviorCorrelation(new FakeNode())); finish.LogException(new NotImplementedException()); var tag = new BehaviorStartAndFinishEndpoints().VisualizePartial(finish); tag.Children.FirstOrDefault(x => x.HasClass("exception")).Text().ShouldEqual( typeof(NotImplementedException).Name); tag.Next.ShouldBeOfType <ExceptionReportTag>(); }
public HtmlTag VisualizePartial(BehaviorFinish finish) { var description = Description.For(finish.Correlation.Node); var tag = new HtmlTag("div").AddClass("behavior-finish"); tag.Add("span").Text("Finished ").Add("i").Text(description.Title); if (!finish.Succeeded) { tag.Next = new ExceptionReportTag(finish.Exception); tag.Add("span").Text(finish.Exception.ExceptionType).AddClass("exception"); } tag.PrependGlyph("icon-chevron-up"); return(tag); }
protected override void invoke(Action action) { _trace.Log(new BehaviorStart(_correlation)); try { action(); _trace.Log(new BehaviorFinish(_correlation)); } catch (Exception ex) { if (!_exceptionObserver.WasObserved(ex)) { var log = new BehaviorFinish(_correlation); log.LogException(ex); _trace.Log(log); } throw; } }