Added more descriptive error messages

This commit is contained in:
neviyn 2019-07-25 16:05:06 +01:00
parent 7b34c5c9ba
commit 507cf9edd1

View File

@ -285,11 +285,12 @@ class ObservationsController {
if (::mailer.isInitialized) { if (::mailer.isInitialized) {
val data = getObservations(observationsRequest) val data = getObservations(observationsRequest)
if (data.isEmpty()) if (data.isEmpty())
return false throw ResponseStatusException(HttpStatus.BAD_REQUEST, "Request would send no data.")
mailer.sendObservationData(data) mailer.sendObservationData(data)
return true return true
} else } else {
logger.error("Mailer has not been initialized.") logger.error("Mailer has not been initialized.")
return false throw ResponseStatusException(HttpStatus.SERVICE_UNAVAILABLE, "Mail is currently unavailable due to a server configuration error.")
}
} }
} }