Validator functions for error value types created by {mirai}.
is_mirai_error(x)
is_mirai_interrupt(x)
is_error_value(x)
an object.
Logical value TRUE or FALSE.
Is the object a 'miraiError'. When execution in a mirai process fails, the error message is returned as a character string of class 'miraiError' and 'errorValue'.
Is the object a 'miraiInterrupt'. When a mirai is sent a user interrupt,
e.g. by ctrl+c during an ongoing call_mirai
, the mirai
will resolve to an empty character string classed as 'miraiInterrupt' and
'errorValue'.
Is the object an 'errorValue', such as a mirai timeout, a 'miraiError' or a 'miraiInterrupt'. This is a catch-all condition that includes all returned error values, such as timeouts, as well as the error types above.
if (interactive()) {
# Only run examples in interactive R sessions
m <- mirai(stop())
call_mirai(m)
is_mirai_error(m$data)
is_mirai_interrupt(m$data)
is_error_value(m$data)
m2 <- mirai(Sys.sleep(1L), .timeout = 100)
call_mirai(m2)
is_mirai_error(m2$data)
is_mirai_interrupt(m2$data)
is_error_value(m2$data)
}