-
Notifications
You must be signed in to change notification settings - Fork 88
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
better call routing for errors #1214
Merged
Merged
Changes from 16 commits
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
be5e45e
pass call through user-facing predict methods
topepo a68797e
pass call for internal code; probably will never be surfaced by user
70cb404
show error is from autoplot() instead of map_glmnet_coefs()
42410da
un-used bartMachine code
708be70
fix bug in condense_control and route user-facing call
064721c
unit tests for one-hot encodings
47147c3
pass calls through data conversion functions
c29e8b0
redoc
f97a6cc
small formatting changes
d5166a7
route some glmnet checking calls
448a74d
route some spec updating calls
d6f5d93
some predict call routing
a8e1798
make dev function as internal
b9067af
redoc
c0e81cb
revert passing in predict
f79274b
Merge branch 'main' into pass-call-through
e4ea7a3
Apply suggestions from code review
topepo 7097a79
update snapshots
topepo d2dd6e0
redoc
topepo File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,6 +10,10 @@ | |
#' | ||
#' @return A control object with the same elements and classes of `ref`, with | ||
#' values of `x`. | ||
#' @param call The execution environment of a currently running function, e.g. | ||
#' `caller_env()`. The function will be mentioned in error messages as the | ||
#' source of the error. See the call argument of [rlang::abort()] for more | ||
#' information. | ||
#' @keywords internal | ||
#' @export | ||
#' | ||
|
@@ -20,16 +24,17 @@ | |
#' | ||
#' ctrl <- condense_control(ctrl, control_parsnip()) | ||
#' str(ctrl) | ||
condense_control <- function(x, ref) { | ||
condense_control <- function(x, ref, call = rlang::caller_env()) { | ||
topepo marked this conversation as resolved.
Show resolved
Hide resolved
|
||
mismatch <- setdiff(names(ref), names(x)) | ||
if (length(mismatch)) { | ||
cli::cli_abort( | ||
c( | ||
"Object of class {.cls class(x)[1]} cannot be coerced to | ||
object of class {.cls class(ref)[1]}.", | ||
"Object of class {.cls {class(x)[1]}} cannot be coerced to | ||
object of class {.cls {class(ref)[1]}}.", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nice catch! There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Even better, I changed it to |
||
"i" = "{cli::qty(mismatch)} The argument{?s} {.arg {mismatch}} | ||
{?is/are} missing." | ||
) | ||
), | ||
call = call | ||
) | ||
} | ||
res <- x[names(ref)] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll just make this comment once to apply throughout the PR, but rlang is imported with
@import rlang
so we don't need to namespace rlang for these!There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It all comes back to psock... we started namespacing everything in these packages because importing was not enough.