New issue
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
Suggestion: Better error message openxlsx2:::assert_workbook #770
Comments
I cannot say that I have a strong opinion on this. But I guess we integrate this into assert <- function(wb) {
if (!hasArg(wb)) stop("did not found wb")
print("all good!")
}
assert()
#> Error in assert(): did not found wb
assert(wb = 1)
#> [1] "all good!"
assert(1)
#> [1] "all good!"
wb <- substitute()
assert(wb)
#> Error in assert(wb): did not found wb
wb <- 1
assert(wb)
#> [1] "all good!" Otherwise we'd have to add a bunch of |
I have tried to add this into #772 |
Thank you 👍 At least I was confused by the error message. Tought that I fiddled with the class of the workbook somewhere along the lines by accident. And the cascades of "Why? Where?" questions started in my head. 😄 |
Yeah, don't get to addicted to piping ;) |
Too late. 🤣 |
Background
openxlsx2:::assert_workbook
is a function that checks the class of workbook-objects before performing operations on it:I happened to write a
targets
pipeline missing a pipe from one workbook manipulation into the next, resulting in:Last error: wb must be class wbWorkbook or R6
Which I find to be a little confusing.
Suggestion
I think it would be nice to check for missing wb before asserting class, thus throwing a more precise error message, something along the way of:
The text was updated successfully, but these errors were encountered: