private SkExceptionHandleAction GetExceptionActionFromConfig(string config, SkExceptionHandleAction defaultAction) { var actionStr = ConfigurationManager.AppSettings[config]; if (!string.IsNullOrEmpty(actionStr)) { SkExceptionHandleAction action; if (Enum.TryParse(actionStr, out action)) { return(action); } return(defaultAction); } return(defaultAction); }
private static void HandleExceptioin(Exception ex, SkExceptionHandleAction action) { //No action if (action == SkExceptionHandleAction.None) { return; } //log exception if (action == SkExceptionHandleAction.LogAndRethrow) { var logger = SkServiceLocator.Get <SkLoggerBase>(); if (logger != null) { logger.LogError(ex); } } // throw current exception if (action == SkExceptionHandleAction.Rethrow || action == SkExceptionHandleAction.LogAndRethrow) { throw ex; } }