private IQueryable <Student> TryCatch(ReturningStudentsFunction returningStudentsFunction) { try { return(returningStudentsFunction()); } catch (SqlException sqlException) { throw CreateAndLogCriticalDependencyException(sqlException); } }
private IQueryable <Student> TryCatch(ReturningStudentsFunction returningStudentsFunction) { try { return(returningStudentsFunction()); } catch (SqlException sqlException) { throw CreateAndLogCriticalDependencyException(sqlException); } catch (Exception exception) { var failedStudentServiceException = new FailedStudentServiceException(exception); throw CreateAndLogServiceException(failedStudentServiceException); } }
private async ValueTask <List <Student> > TryCatch(ReturningStudentsFunction returningStudentsFunction) { try { return(await returningStudentsFunction()); } catch (HttpRequestException httpRequestException) { var failedStudentDependencyException = new FailedStudentDependencyException(httpRequestException); throw CreateAndLogCriticalDependencyException(failedStudentDependencyException); } catch (HttpResponseUrlNotFoundException httpResponseUrlNotFoundException) { var failedStudentDependencyException = new FailedStudentDependencyException(httpResponseUrlNotFoundException); throw CreateAndLogCriticalDependencyException(failedStudentDependencyException); } catch (HttpResponseUnauthorizedException httpResponseUnauthorizedException) { var failedStudentDependencyException = new FailedStudentDependencyException(httpResponseUnauthorizedException); throw CreateAndLogCriticalDependencyException(failedStudentDependencyException); } catch (HttpResponseException httpResponseException) { var failedStudentDependencyException = new FailedStudentDependencyException(httpResponseException); throw CreateAndLogDependencyException(failedStudentDependencyException); } catch (Exception serviceException) { var failedStudentDependencyException = new FailedStudentServiceException(serviceException); throw CreateAndLogServiceException(failedStudentDependencyException); } }