Skip to content

Commit

Permalink
Check for potential null when unwrapping error message
Browse files Browse the repository at this point in the history
  • Loading branch information
byrongibby committed Oct 18, 2024
1 parent d651651 commit b71be12
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion R/write_database.R
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ write_database <- function(x, method = "update", ...) {
} else {
error <- content(response, type = "application/json")
if (response$status_code == 400) {
if (error$message == "Validation error") {
if (!is.null(error$message) && error$message == "Validation error") {
stop(toJSON(error, pretty = TRUE))
} else {
stop(error)
Expand Down
5 changes: 3 additions & 2 deletions R/write_dataset.R
Original file line number Diff line number Diff line change
Expand Up @@ -101,12 +101,13 @@ write_dataset <- function(x, method = "stage", ...) {
} else {
error <- content(response, type = "application/json")
if (response$status_code == 400) {
if (error$message == "Validation error") {
browser()
if (!is.null(error$message) && error$message == "Validation error") {
stop(toJSON(error, pretty = TRUE))
} else {
stop(error)
}
} else {
} else {
stop(error)
}
}
Expand Down

0 comments on commit b71be12

Please sign in to comment.