| expect_pkg_error_classes | R Documentation |
When you use pkg_abort() to signal errors, you can use this function to
test that those errors are generated as expected.
expect_pkg_error_classes(object, package, ...)
object |
An expression that is expected to throw an error. |
package |
|
... |
|
The classes of the error invisibly on success or the error on failure. Unlike most testthat expectations, this expectation cannot be usefully chained.
expect_pkg_error_classes(
pkg_abort("stbl", "This is a test error", "test_subclass"),
"stbl",
"test_subclass"
)
try(
expect_pkg_error_classes(
pkg_abort("stbl", "This is a test error", "test_subclass"),
"stbl",
"different_subclass"
)
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.