| zucbor-conditions | R Documentation |
Every error zucbor raises carries a condition class, so it can be caught
by kind rather than by matching the message, which may change. Every
class below inherits from zucbor_error.
zucbor_invalid_argumentAn argument was unusable: an input that
is not a raw vector, a flag that is not TRUE or FALSE, a limit
that is not a positive whole number within its range, or a value
cbor_encode() cannot write as given, such as partial names or a
string that is not valid UTF-8.
zucbor_parse_errorThe input is not well-formed CBOR: it ends early, uses a reserved encoding, has a misplaced "break", or has bytes after the item.
zucbor_invalid_errorThe input is well-formed but not valid: a text string that is not UTF-8, a tag whose content has the wrong type, a typed array whose length is not a whole number of elements, or a multi-dimensional array whose shape does not match its elements.
zucbor_deterministic_errordeterministic = TRUE and the input
is not in RFC 8949 core deterministic encoding.
zucbor_duplicate_keyA map has the same key twice and
duplicate_keys = FALSE.
zucbor_unrepresentableThe input is valid CBOR but holds a
value R cannot: a text string containing U+0000 or longer than an R
string, a tag number beyond 2^53, an integer beyond 2^53 with
big_integers = "error", or an array dimension beyond R's limit.
zucbor_unsupported_typecbor_encode() was given an R value
with no CBOR form, such as a function, an environment, POSIXlt or a
data frame.
zucbor_handler_errorA function in cbor_decode()'s
tag_handlers raised an error. The condition carries tag, the tag
number, and parent, the error the handler raised.
zucbor_io_errorcbor_read() or cbor_read_seq() could not
read from its connection. The message includes R's own.
zucbor_limit_errorA limit was reached. The subclasses
zucbor_depth_limit, zucbor_size_limit, zucbor_item_limit and
zucbor_cell_limit name which one.
A condition raised while checking input carries offset, the 0-based
byte offset of the item at fault, or NA when the validator that found
the fault reports no position; and status, the name of the underlying
status, such as "CborErrorUnexpectedEOF". It is there for diagnostics:
branch on the class, not on it. A limit error also carries limit, the
argument's name, such as "max_depth", and limit_value. A
zucbor_invalid_argument condition carries arg, the argument at fault.
tryCatch(
cbor_validate(as.raw(c(0x82, 0x01)), error = TRUE),
zucbor_parse_error = function(e) e$offset
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.