We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Plumber should return a 400 Bad Content when a parser can't parse content. Invalid json, xml, etc...
Likely fix with the generalized plumberError condition approach.
The text was updated successfully, but these errors were encountered:
This would be a very welcomed feature 😊.
As of now, I use a somewhat hacky approach for JSON errors. Certainly not perfect but maybe this helps someone in the meantime...
error_handler <- function(req, res, err) { if (!inherits(err, "api_error") && grepl("lexical error", err$message, fixed = TRUE)) { res$status <- 400 body <- "Received malformed JSON." logger::log_error( 'malformed_json "{err}"' ) } else if (!inherits(err, "api_error")) { res$status <- 500 body <- "Internal server error." logger::log_error( 'internal_error "{err}"' ) } else { res$status <- err$status body <- err$message } res$body <- list(message = body) }
Sorry, something went wrong.
No branches or pull requests
Plumber should return a 400 Bad Content when a parser can't parse content. Invalid json, xml, etc...
Likely fix with the generalized plumberError condition approach.
The text was updated successfully, but these errors were encountered: