private async ValueTask <Student> TryCatch(ReturningStudentFunction returningStudentFunction) { try { return(await returningStudentFunction()); } catch (NullStudentException nullStudentException) { throw CreateAndLogValidationException(nullStudentException); } }
private async ValueTask <Student> TryCatch(ReturningStudentFunction returningStudentFunction) { try { return(await returningStudentFunction()); } catch (NullStudentException nullStudentException) { throw CreateAndLogValidationException(nullStudentException); } catch (InvalidStudentException invalidStudentException) { throw CreateAndLogValidationException(invalidStudentException); } catch (NotFoundStudentException nullStudentException) { throw CreateAndLogValidationException(nullStudentException); } catch (SqlException sqlException) { var failedStudentStorageException = new FailedStudentStorageException(sqlException); throw CreateAndLogCriticalDependencyException(failedStudentStorageException); } catch (DuplicateKeyException duplicateKeyException) { var alreadyExistsStudentException = new AlreadyExistsStudentException(duplicateKeyException); throw CreateAndLogDependencyValidationException(alreadyExistsStudentException); } catch (DbUpdateConcurrencyException dbUpdateConcurrencyException) { var lockedStudentException = new LockedStudentException(dbUpdateConcurrencyException); throw CreateAndLogDependencyException(lockedStudentException); } catch (DbUpdateException dbUpdateException) { var failedStudentStorageException = new FailedStudentStorageException(dbUpdateException); throw CreateAndLogDependencyException(failedStudentStorageException); } catch (Exception exception) { var failedStudentServiceException = new FailedStudentServiceException(exception); throw CreateAndLogServiceException(failedStudentServiceException); } }
private async ValueTask <Student> TryCatch(ReturningStudentFunction returningStudentFunction) { try { return(await returningStudentFunction()); } catch (NullStudentException nullStudentException) { throw CreateAndLogValidationException(nullStudentException); } catch (InvalidStudentException invalidStudentException) { throw CreateAndLogValidationException(invalidStudentException); } catch (HttpRequestException httpRequestException) { throw CreateAndLogCriticalDependencyException(httpRequestException); } catch (HttpResponseUrlNotFoundException httpResponseUrlNotFoundException) { throw CreateAndLogCriticalDependencyException(httpResponseUrlNotFoundException); } catch (HttpResponseUnauthorizedException httpResponseUnauthorizedException) { throw CreateAndLogCriticalDependencyException(httpResponseUnauthorizedException); } catch (HttpResponseConflictException httpResponseConflictException) { throw CreateAndLogDependencyValidationException(httpResponseConflictException); } catch (HttpResponseBadRequestException httpResponseBadRequestException) { throw CreateAndLogDependencyValidationException(httpResponseBadRequestException); } catch (HttpResponseInternalServerErrorException httpResponseInternalServerException) { throw CreateAndLogDependencyException(httpResponseInternalServerException); } catch (HttpResponseException httpResponseException) { throw CreateAndLogDependencyException(httpResponseException); } catch (Exception serviceException) { throw CreateAndLogServiceException(serviceException); } }
private async ValueTask <Student> TryCatch(ReturningStudentFunction returningStudentFunction) { try { return(await returningStudentFunction()); } catch (NullStudentException nullStudentException) { throw CreateAndLogValidationException(nullStudentException); } catch (InvalidStudentException invalidStudentException) { throw CreateAndLogValidationException(invalidStudentException); } catch (SqlException sqlException) { throw CreateAndLogCriticalDependencyException(sqlException); } catch (NotFoundStudentException studentNotFoundException) { throw CreateAndLogValidationException(studentNotFoundException); } catch (DuplicateKeyException duplicateKeyException) { var studentAlreadyExistsException = new AlreadyExistsStudentException(duplicateKeyException); throw CreateAndLogValidationException(studentAlreadyExistsException); } catch (DbUpdateException dbUpdateException) { throw CreateAndLogDependencyException(dbUpdateException); } catch (ValidationException validationException) { throw CreateAndLogValidationException(validationException); } catch (Exception exception) { throw CreateAndLogServiceException(exception); } }