public static void SaveException(Exception ex) { if (ex.Data.Contains((object)"SavedException")) { return; } ExceptionData exData = new ExceptionData(ex); ExceptionManager.Save(exData); if (ex.Data.Contains((object)"ExceptionCode")) { ex.Data[(object)"ExceptionCode"] = (object)exData.Code; } else { ex.Data.Add((object)"ExceptionCode", (object)exData.Code); } ex.Data.Add((object)"SavedException", (object)true); }
public static async Task SaveExceptionAsync(Exception ex) { if (ex.Data.Contains((object)"SavedException")) { return; } string code = string.Empty; ExceptionData exData = new ExceptionData(ex); code = exData.Code; if (ex.Data.Contains((object)"ExceptionCode")) { ex.Data[(object)"ExceptionCode"] = (object)code; } else { ex.Data.Add((object)"ExceptionCode", (object)code); } await ExceptionManager.SaveAsync(exData); ex.Data.Add((object)"SavedException", (object)true); }
private static void Save(ExceptionData exData) { try { foreach (IExceptionLogger exceptionLogger in ConfigurationController.ExceptionLoggers) { try { using (new TransactionScope(TransactionScopeOption.Suppress)) exceptionLogger.LogException(exData); } catch (Exception ex) { EventLogHelper.Write(ExceptionManager.GetExceptionMessageWithDebugInfo((Exception) new OMFException(string.Format("{0} exception", (object)exceptionLogger.GetType().FullName), ex)), EventLogEntryType.Error); } } } catch (Exception ex) { throw new LogManagementException("[ExceptionServiceLoggerName] failed and throw an exception", ex); } }
private static async Task SaveAsync(ExceptionData exData) { try { foreach (IExceptionLogger exceptionLogger in ConfigurationController.ExceptionLoggers) { IExceptionLogger exLogger = exceptionLogger; try { using (new TransactionScope(TransactionScopeOption.Suppress)) { if (exLogger is IExceptionLoggerAsync) { await((IExceptionLoggerAsync)exLogger).LogExceptionAsync(exData); } else { exLogger.LogException(exData); } } } catch (Exception ex) { OMFException dwdEx = new OMFException(string.Format("{0} exception: {1}", (object)exLogger.GetType().FullName, (object)ex.Message), exData.Exception); string message = ExceptionManager.GetExceptionMessageWithDebugInfo((Exception)dwdEx); EventLogHelper.Write(message, EventLogEntryType.Error); continue; } exLogger = (IExceptionLogger)null; } } catch (Exception ex) { throw new LogManagementException("[ExceptionServiceLoggerName] failed and throw an exception", ex); } }