public void OrThrow(ExceptionFactoryDelegate ExceptionFactory) { try { action(); } catch (Exception ex) { Logger.Log(ComponentID, ComponentName, MethodName, LogLevels.Error, ExceptionFormatter.Format(ex)); throw ExceptionFactory(ex, ComponentID, ComponentName, MethodName); } }
public async Task <T> OrThrow(ExceptionFactoryDelegate ExceptionFactory) { try { return(await function); } catch (Exception ex) { Logger.Log(ComponentID, ComponentName, MethodName, LogLevels.Error, ExceptionFormatter.Format(ex)); throw ExceptionFactory(ex, ComponentID, ComponentName, MethodName); } }
public void OrThrow <TException>(string Message) where TException : TryException { try { action(); } catch (Exception ex) { Logger.Log(ComponentID, ComponentName, MethodName, LogLevels.Error, ExceptionFormatter.Format(ex)); throw (TException)Activator.CreateInstance(typeof(TException), Message, ex, ComponentID, ComponentName, MethodName); } }
public bool OrWarn(string Message) { return(OrWarn((Ex) => $"{Message}: {ExceptionFormatter.Format(Ex)}")); }
public bool OrWarn(out T Result, string Message) { return(OrWarn(out Result, (Ex) => $"{Message}: {ExceptionFormatter.Format(Ex)}")); }
public async Task <bool> OrWarn(string Message) { return(await OrWarn((Ex) => $"{Message}: {ExceptionFormatter.Format(Ex)}")); }