public void OnError(string reporterName, Exception exception) { if (!ReportInformation.HasObservers) { return; } if (exception is AggregateException) { var exceptions = exception as AggregateException; foreach (var e in exceptions.InnerExceptions) { ReportExceptions.OnNext(new LogMessage <Exception>() { Reporter = reporterName, Level = LogLevel.Error, Message = e }); } } else { ReportExceptions.OnNext(new LogMessage <Exception>() { Reporter = reporterName, Level = LogLevel.Error, Message = exception }); } }
public void OnError(string reporterName, Exception innerException, string exceptionMessage, params object[] args) { ReportExceptions.OnNext(new LogMessage <Exception>() { Reporter = reporterName, Level = LogLevel.Error, Message = new Exception(String.Format(exceptionMessage, args), innerException) }); }
public IDisposable Chain <T>(IReactor <T> another) where T : IRxn { var resources = new CompositeDisposable(); Input.Subscribe(e => another.Input.OnNext((T)e), e => ReportExceptions.OnNext(new LogMessage <Exception>() { Reporter = another.ReporterName, Level = LogLevel.Error, Message = e })).DisposedBy(resources); another.Output.Subscribe(r => Output.OnNext(r), e => ReportExceptions.OnNext(new LogMessage <Exception>() { Reporter = another.ReporterName, Level = LogLevel.Error, Message = e })).DisposedBy(resources); another.Errors.Subscribe(ReportExceptions).DisposedBy(_resources);//only report errors so we can see error state var health = AttachHealthMonitorIf(another); _molecules.Add(another); OnInformation("Chained to '{0}'", another.Name); return(new CompositeDisposable(resources, new DisposableAction(() => { if (health != null) { health.Dispose(); } OnInformation("Unchained '{0}'", another.Name); _molecules.Remove(another); })) .DisposedBy(_resources)); }