internal static void HandleException(string methodName, Exception exception, TraceType traceType) { var te = exception as TimeoutException; if (te != null) { Trace.WriteWarning(traceType, "{0}: Operation timed out. Exception: {1}", methodName, te.ToString()); return; } var oce = exception as OperationCanceledException; if (oce != null) { Trace.WriteWarning(traceType, "{0}: One or more tasks have been canceled. Exception: {1}", methodName, oce.ToString()); return; } var ae = exception as AggregateException; if (ae != null) { ae.Flatten().Handle(innerException => { Trace.WriteWarning(traceType, "{0}: InnerException encountered: {1}", methodName, innerException.ToString()); return(true); }); return; } Trace.WriteWarning(traceType, "{0}: Suppressing exception: {1}", methodName, exception.ToString()); }
public static COMException CreateException(TraceType traceType, NativeTypes.FABRIC_ERROR_CODE error, string format, params object[] args) { string message = string.Format(CultureInfo.InvariantCulture, format, args); var exception = new COMException(message, (int)error); traceSource.WriteExceptionAsWarning(traceType.Name, exception); return(exception); }
internal ExceptionHandlingPolicy( string healthProperty, string taskName, IConfigStore configStore, string configSectionName, IStatefulServicePartition partition) { healthProperty.ThrowIfNullOrWhiteSpace(nameof(healthProperty)); taskName.ThrowIfNullOrWhiteSpace(nameof(taskName)); configStore.ThrowIfNull(nameof(configStore)); configSectionName.ThrowIfNullOrWhiteSpace(nameof(configSectionName)); partition.ThrowIfNull(nameof(partition)); this.configStore = configStore; this.configSectionName = configSectionName; this.partition = partition; this.HealthProperty = healthProperty; this.TaskName = taskName; this.ContinuousFailureCount = 0; this.TraceType = new TraceType(healthProperty); }
public static void ConsoleWriteLine(TraceType traceType, string format, params object[] args) { traceSource.WriteInfo(traceType.Name, format, args); }
public static void WriteError(TraceType traceType, string format, params object[] args) { traceSource.WriteError(traceType.Name, format, args); }