Dear Community,
I would like to know how to set up a nice error message that can provide to the user if some parameters are missing.
I hope one day this feature could be added automatically from plumber
I am using this code when error happens
#* @tag ErrorMessages
#* @param vegetationindex:character
#* @param filterTime:character
#* @param initialmap:character
#* @post /value
#* @serializer octet
function(res, req, vegetationindex, filterTime, initialmap) {
future::future({
check_can_use<-req$module_activation$SatelliteImages==TRUE
if (check_can_use==TRUE) {
maps_to_check<-c("CartoNormal","CartoDark","OpenStreetMap","EsriWorldImagery","OpenTopoMap")
if (initialmap %in% maps_to_check) {
} else {
res$status <- 400
list(Error = "You requested a initial map that is not in the available list of base maps. Please use only those available in the list CartoNormal; CartoDark, OpenStreetMap, EsriWorldImagery, OpenTopoMap")
}
} else {
res$status <- 400
list(Error = "Invalid credentials")
}
})
}
This is the log of the plumber api
While when i am using the postman this is the results