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); } }