-
Notifications
You must be signed in to change notification settings - Fork 325
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
expect_snapshot() and chained errors #1471
Comments
As chain errors will imminently start to appear when |
Probably need to delegate "whole-error" (not sure how to call this) generation to rlang. Related to showing rlang's whole-error message in knitr. |
This comment has been minimized.
This comment has been minimized.
Should |
Probably not since using condition expectations inside |
We also considered if Maybe |
I think we could implement (and maybe export?) I briefly considered whether the same principle should apply to other expectations, but since they usually invisibly return the actual value (for piping), it doesn't seem useful. @DavisVaughan do you want to do a PR? |
Sure |
I think the motivating issue here has been resolved by #1491; if you want to see the full chain of rlang errors, you just need to depend on the dev version of rlang. This will become the default display at some point in the future. I think we can move away from the
(The same logic will apply to the error For the arrow example, I think the code would be mostly cleaner by using Does that sound reasonable to everyone? (I'm closing this issue, but I'll open new issues if the discussion reveals that we're still missing pieces) |
Does |
Another option would be to allow foo <- function() {
rlang::abort("This is an error", class = "myError")
}
expect_snapshot(foo(), error = "myError") |
Yes that would help I think. Also they should take To be honest, I find
That said these are not huge issues and I'd be fine using the condition-specific snapshotters as outlined above, since you seem to prefer them. |
I really don't like conditionally making |
I have come to like using I also like to have many |
@romainfrancois you don't like |
I sort of "tolerate" it now. It's not as bad as I perceived it first, and it does allow for both expecting the error, and showing what it looks like. The patten might be surprising to users who have not seen it before, and it might not be clear where to go from there because there's no documentation to read for |
Ok, I'm going to leave as is for this release but think about again the next time we do a minor release. |
From tidyverse/dplyr#6044
expect_snapshot()
is currently not showing the chain of errors (the Caused by). The typical workaround is to use theexpect_snapshot() + (expect_error())
patternThe text was updated successfully, but these errors were encountered: