private IQueryable <Teacher> TryCatch(ReturningQueryableTeacherFunction returningQueryableTeacherFunction)
        {
            try
            {
                return(returningQueryableTeacherFunction());
            }
            catch (SqlException sqlException)
            {
                throw CreateAndLogCriticalDependencyException(sqlException);
            }
            catch (DbUpdateConcurrencyException dbUpdateConcurrencyException)
            {
                var lockedTeacherException = new LockedTeacherException(dbUpdateConcurrencyException);

                throw CreateAndLogDependencyException(lockedTeacherException);
            }
            catch (DbUpdateException dbUpdateException)
            {
                throw CreateAndLogDependencyException(dbUpdateException);
            }
            catch (Exception exception)
            {
                throw CreateAndLogServiceException(exception);
            }
        }
Exemple #2
0
        private IQueryable <Teacher> TryCatch(ReturningQueryableTeacherFunction returningQueryableTeacherFunction)
        {
            try
            {
                return(returningQueryableTeacherFunction());
            }
            catch (SqlException sqlException)
            {
                var failedTeacherStorageExceptin =
                    new FailedTeacherStorageException(sqlException);

                throw CreateAndLogCriticalDependencyException(failedTeacherStorageExceptin);
            }
            catch (Exception exception)
            {
                var failedTeacherServiceException =
                    new FailedTeacherServiceException(exception);

                throw CreateAndLogServiceException(failedTeacherServiceException);
            }
        }