Silences a stbl error with the specified subclass. Other errors
(including other stbl errors) are not caught and propagate normally. See
the documentation of each stabilize_*() or to_*() function for the types
of errors it throws.
Arguments
- expr
An expression to evaluate.
- subclass
(
character) The subclass(es) of thestblerror to ignore. Combined with"stbl-error-"to form the class name to intercept. For example,c("coerce", "character")silences errors of classstbl-error-coerce-character(stabilize_chr()), whilec("coerce")silences anystbl-error-coerceerror.
Value
The result of expr if no matching error is thrown, or NULL
if a matching stbl error is caught.
Examples
ignore_stbl_error(to_chr(data.frame()), subclass = c("coerce", "character"))
#> NULL
ignore_stbl_error(to_chr("hello"), subclass = c("coerce", "character"))
#> [1] "hello"