Every error zubin raises inherits zubin_error, and its class says what
went wrong, so code catches it by kind and reads the details from its
fields; messages may be reworded. Every offset and index is 0-based. The
call is reduced to the function's name, so that a large raw vector is
never printed with an error.
Details
zubin_invalid_argumentAn argument is unusable: the wrong type, a negative or fractional size, an unknown type token, a column with no field, or a builder that was saved and restored. Field:
arg, the argument's name, when there is one.zubin_spec_errorA layout specification is malformed. Field:
position, the byte in the specification where the problem is.zubin_bounds_errorThe records asked for run past the end of the input. Fields:
offsetandlength.zubin_range_errorA value does not fit: 300 into
u8, 1.5 into an integer type, ani64above 2^53 read as a double, a string longer than its field. Fields:field(NAfor a codec) andindex, the record of the first such value.zubin_na_errorAn
NAhas no bytes in its field. Fields:fieldandindex.zubin_encoding_errorAn
s<n>field read is not valid UTF-8 (read it withencoding = "latin1"or"bytes"), or a string to be written is not (mark it"bytes"to write its bytes as they are). Fields:fieldandindex.zubin_limit_errorAn append would pass a builder's
max, which leaves it unchanged. Fields:size, what the builder would have held, andmax.zubin_memory_errorAn allocation zubin makes itself failed (a builder's storage), or a size would not fit in memory. A result that R allocates, such as the columns of
bin_unpack(), fails as R's own allocations do, with R'scannot allocate vectorerror.
Examples
tryCatch(
bin_encode(c(1, 300), "u8"),
zubin_range_error = function(e) e$index
)
#> [1] 1
tryCatch(
bin_layout("id:u32 name:s0"),
zubin_spec_error = function(e) e$position
)
#> [1] 13