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

Comments

Projects
None yet
2 participants
@hughjonesd

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 closed this in e7c930d Mar 29, 2018

@jimhester jimhester added the bug label Mar 29, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment