示例#1
0
 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)
     });
 }
示例#2
0
        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));
        }
示例#3
0
 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
         });
     }
 }
示例#4
0
 /// <summary>
 /// Converts a "report exceptions" to the equivalent XMS value.
 /// </summary>
 /// <param name="inputValue">Input value.</param>
 /// <returns>Converted value.</returns>
 public static Int32 ToXMSReportExceptions(
     ReportExceptions inputValue)
 {
     return((Int32)inputValue);
 }