Example #1
0
 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);
     }
 }
Example #2
0
 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);
     }
 }
Example #3
0
 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);
     }
 }
Example #4
0
 public bool OrWarn(string Message)
 {
     return(OrWarn((Ex) => $"{Message}: {ExceptionFormatter.Format(Ex)}"));
 }
Example #5
0
 public bool OrWarn(out T Result, string Message)
 {
     return(OrWarn(out Result, (Ex) => $"{Message}: {ExceptionFormatter.Format(Ex)}"));
 }
Example #6
0
 public async Task <bool> OrWarn(string Message)
 {
     return(await OrWarn((Ex) => $"{Message}: {ExceptionFormatter.Format(Ex)}"));
 }