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); } }
private IQueryable <Course> TryCatch(ReturningQueryableCourseFunction returningQueryableCourseFunction) { try { return(returningQueryableCourseFunction()); } catch (SqlException sqlException) { throw CreateAndLogCriticalDependencyException(sqlException); } catch (Exception exception) { throw CreateAndLogServiceException(exception); } }