Currently get_raster has a date range limit of 366 days. Currently when users request longer time ranges the error message is difficult to interpret, though the API returns a reasonable message.
Turns out the error handling in gist_error_body doesn't work with the error structure returned by the 4wings API
the following function does work, but I am not certain if it works with other API endpoints. We need to check. Note I have changed to messages and we need to access the messages list using [[ 1]].
gist_error_body <- function(resp) {
body <- httr2::resp_body_json(resp)
messages <- body$messages
if(length(messages[[1]]) > 1){
messages <- purrr::map_chr(messages, purrr::pluck, 'detail')
}
messages
}
@tclavelle Could you take a look at this given you explored the error handling for other API endpoints?
Currently
get_raster
has a date range limit of 366 days. Currently when users request longer time ranges the error message is difficult to interpret, though the API returns a reasonable message.Turns out the error handling in
gist_error_body
doesn't work with the error structure returned by the 4wings APIThis is the current form
the following function does work, but I am not certain if it works with other API endpoints. We need to check. Note I have changed to
messages
and we need to access the messages list using[[ 1]]
.