Skip to content
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_error does not return caught errors #724

Closed
hughjonesd opened this issue Mar 2, 2018 · 0 comments
Closed

expect_error does not return caught errors #724

hughjonesd opened this issue Mar 2, 2018 · 0 comments
Labels
bug an unexpected problem or unintended behavior

Comments

@hughjonesd
Copy link

hughjonesd commented Mar 2, 2018

From ?expect_error:

If expect_error() captures an error, that is returned instead of the value.

In fact it always returns NULL on an error:

res <- expect_error(stop("foo"), "foo")
res
# NULL
res <- expect_error(stop("foo"))
res
# NULL
res <- expect_error(stop("foo"), NA)
Error: `stop("foo")` threw an error.
Message: foo
Class:   simpleError/error/condition
res
# NULL
@jimhester jimhester added the bug an unexpected problem or unintended behavior label Mar 29, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug an unexpected problem or unintended behavior
Projects
None yet
Development

No branches or pull requests

2 participants