Exemple #1
0
 public DSWException(string message, Exception innerException, DSWExceptionCode exceptionCode)
     : base(message, innerException)
 {
     _exceptionCode = exceptionCode;
 }
Exemple #2
0
 public DSWException(Type type, string message, Exception innerException, DSWExceptionCode exceptionCode)
     : this(string.Concat(type.AssemblyQualifiedName, message), innerException, exceptionCode)
 {
 }
Exemple #3
0
 public DSWValidationException(Type type, string message, IReadOnlyCollection <ValidationMessageModel> validationMessages, DSWException innerException, DSWExceptionCode exceptionCode)
     : this(string.Concat(type.AssemblyQualifiedName, message), validationMessages, innerException, exceptionCode)
 {
 }
Exemple #4
0
 public DSWValidationException(string message, IReadOnlyCollection <ValidationMessageModel> validationMessages,
                               DSWException innerException, DSWExceptionCode exceptionCode)
     : base(message, innerException, exceptionCode)
 {
     _validationMessages = validationMessages ?? new ReadOnlyCollection <ValidationMessageModel>(new List <ValidationMessageModel>());
 }
Exemple #5
0
 public static T TryCatchWithLogger <T>(Func <T> func, ILogger logger, IEnumerable <LogCategory> logCategories, string methodName, DSWExceptionCode code)
 {
     try
     {
         return(func());
     }
     catch (AggregateException ae)
     {
         foreach (Exception ie in ae.Flatten().InnerExceptions)
         {
             if (ie is DbEntityValidationException)
             {
                 EvaluateExeption(logger, logCategories, methodName, ie as DbEntityValidationException);
             }
             else
             {
                 if (ie is DbUpdateConcurrencyException)
                 {
                     EvaluateExeption(logger, logCategories, methodName, ie as DbUpdateConcurrencyException);
                 }
                 else
                 {
                     if (ie is DbUpdateException)
                     {
                         EvaluateExeption(logger, logCategories, methodName, ie as DbUpdateException);
                     }
                     else
                     {
                         EvaluateExeption(logger, logCategories, methodName, ie as Exception, code);
                     }
                 }
             }
         }
         throw new DSWException(string.Concat(methodName, ".Exception -> ", ae.Message), ae, code);
     }
     catch (DbEntityValidationException dbv_ex)
     {
         EvaluateExeption(logger, logCategories, methodName, dbv_ex);
     }
     catch (DbUpdateConcurrencyException dbc_ex)
     {
         EvaluateExeption(logger, logCategories, methodName, dbc_ex);
     }
     catch (DbUpdateException dbu_ex)
     {
         EvaluateExeption(logger, logCategories, methodName, dbu_ex);
     }
     catch (Exception ex)
     {
         EvaluateExeption(logger, logCategories, methodName, ex, code);
     }
     throw new DSWException(string.Concat(methodName, ".Exception -> <TryCatchWithLogger no path found>"), null, code);
 }
Exemple #6
0
 private static void EvaluateExeption(ILogger logger, IEnumerable <LogCategory> logCategories, string methodName, Exception ex, DSWExceptionCode code)
 {
     logger.WriteError(ex, logCategories);
     throw new DSWException(string.Concat(methodName, ".Exception -> ", ex.Message), ex, code);
 }
Exemple #7
0
 public DSWSecurityException(string message, DSWException innerException, DSWExceptionCode exceptionCode)
     : base(message, innerException, exceptionCode)
 {
 }