diff --git a/backend/src/main/kotlin/uk/co/neviyn/observationdatabase/controller/ObservationsController.kt b/backend/src/main/kotlin/uk/co/neviyn/observationdatabase/controller/ObservationsController.kt index 1d95d04..0c668d0 100644 --- a/backend/src/main/kotlin/uk/co/neviyn/observationdatabase/controller/ObservationsController.kt +++ b/backend/src/main/kotlin/uk/co/neviyn/observationdatabase/controller/ObservationsController.kt @@ -285,11 +285,12 @@ class ObservationsController { if (::mailer.isInitialized) { val data = getObservations(observationsRequest) if (data.isEmpty()) - return false + throw ResponseStatusException(HttpStatus.BAD_REQUEST, "Request would send no data.") mailer.sendObservationData(data) return true - } else + } else { logger.error("Mailer has not been initialized.") - return false + throw ResponseStatusException(HttpStatus.SERVICE_UNAVAILABLE, "Mail is currently unavailable due to a server configuration error.") + } } } \ No newline at end of file