Skip to content

Commit

Permalink
Display reason in error message
Browse files Browse the repository at this point in the history
Since reason seems to contain useful data sometimes.

Fixes #209
  • Loading branch information
hadley committed Mar 28, 2018
1 parent d9713da commit 98dec6f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
3 changes: 3 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# bigrquery 0.4.1.9000

* Request error messages will now contain the "reason", which can contain
useful information for debugging (#209).

# Version 0.4.1

* Fix SQL translation omissions discovered by dbplyr 1.1.0
Expand Down
10 changes: 6 additions & 4 deletions R/request.r
Original file line number Diff line number Diff line change
Expand Up @@ -156,13 +156,15 @@ process_request <- function(req) {
}

signal_reason <- function(reason, message) {
if (!is.null(reason)) {
if (is.null(reason)) {
stop(message, call. = FALSE)
} else {
cl <- c(paste0("bigrquery_", reason), "error", "condition")
message <- paste0(message, " [", reason, "]")

cond <- structure(list(message = message), class = cl)
signalCondition(cond)
stop(cond)
}

stop(message, call. = FALSE)
}

# Multipart/related ------------------------------------------------------------
Expand Down

0 comments on commit 98dec6f

Please sign in to comment.