Ejemplo n.º 1
0
        private IQueryable <Course> TryCatch(ReturningQueryableCourseFunction returningQueryableCourseFunction)
        {
            try
            {
                return(returningQueryableCourseFunction());
            }
            catch (SqlException sqlException)
            {
                throw CreateAndLogCriticalDependencyException(sqlException);
            }
            catch (DuplicateKeyException duplicateKeyException)
            {
                var alreadyExistsCourseException =
                    new AlreadyExistsCourseException(duplicateKeyException);

                throw CreateAndLogValidationException(alreadyExistsCourseException);
            }
            catch (DbUpdateConcurrencyException dbUpdateConcurrencyException)
            {
                var lockedCourseException = new LockedCourseException(dbUpdateConcurrencyException);

                throw CreateAndLogDependencyException(lockedCourseException);
            }
            catch (DbUpdateException dbUpdateException)
            {
                throw CreateAndLogDependencyException(dbUpdateException);
            }
            catch (Exception exception)
            {
                throw CreateAndLogServiceException(exception);
            }
        }
Ejemplo n.º 2
0
 private IQueryable <Course> TryCatch(ReturningQueryableCourseFunction returningQueryableCourseFunction)
 {
     try
     {
         return(returningQueryableCourseFunction());
     }
     catch (SqlException sqlException)
     {
         throw CreateAndLogCriticalDependencyException(sqlException);
     }
     catch (Exception exception)
     {
         throw CreateAndLogServiceException(exception);
     }
 }