Every error zuproto 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 zuproto_error.
Details
zuproto_invalid_argumentAn argument was unusable, such as a pool that is not one, or a type name that is not a single string. Carries
arg, the argument at fault.zuproto_io_errorA file could not be opened or read, or a connection could not be read from.
zuproto_pool_errorA descriptor set could not be added to a pool: the bytes are not a
FileDescriptorSet, a file imports one that is neither in the set nor in the pool, or upb rejected a file. Carriesfile, the file at fault, when there is one.zuproto_pool_conflictA subclass of
zuproto_pool_error: a file of the same name is already in the pool, or earlier in the set, with different contents. Carriesfile.zuproto_unknown_typeA message type is not in the pool. Carries
type.zuproto_parse_errorThe input is not a valid message of the type: it ends early, has a bad tag, a length beyond the input, or the wrong wire type. Carries
status.zuproto_invalid_utf8A subclass of
zuproto_parse_error: astringfield is not valid UTF-8, in proto2 as in proto3.zuproto_unrepresentableThe input is valid but holds a value R cannot: a string containing a NUL byte, or longer than an R string may be. Carries
field, the field's full name.zuproto_type_mismatchproto_encode()was given a value of the wrong form for its field: the wrong R type, a number out of range or not whole, a name that is not a value of the enum,NAinside a repeated field, a string that is not valid UTF-8 text, a date or time where a number is expected (or aDatefor aTimestamp), a second member of a oneof, or a field or map key given twice. Carriespath, the field at fault, such as"points[2].x".zuproto_unknown_fieldproto_encode()was given a name the message type does not define. Carriespath.zuproto_missing_requiredproto_encode()withcheck_required = TRUE: a proto2requiredfield is not set.zuproto_json_errorproto_from_json()was given JSON that is not valid, or not the type's, orproto_to_json()could not write a message (anAnywhose packed type is not in the pool). Carriesdetail, upb's description.zuproto_limit_errorA limit was reached. The subclasses
zuproto_size_limit(the input, or the memory decoding it needs, is too large formax_size),zuproto_depth_limit(messages nest deeper thanmax_depth) andzuproto_row_limit(more rows thanmax_rows) name which. Carrieslimit, the argument's name, andlimit_value, its value. A decode that needs more memory than any message of its type and size could haslimit"memory"andlimit_valueNA: no argument raises that ceiling.proto_encode()raiseszuproto_depth_limitfor messages nested deeper than 1000 levels, the mostmax_depthletsproto_decode()accept.zuproto_internal_errorMemory ran out, or upb reported a status zuproto does not expect. Carries
code.
An error about one message of proto_decode_df(),
proto_read_delimited() or proto_write_delimited() also carries
index, the message's position in the batch or stream. It is a double,
since a stream can hold more than 2^31 - 1 messages.
Warnings inherit zuproto_warning:
zuproto_precision_lossValues could not be represented exactly: 64-bit integers beyond 2^53 decoded as doubles, or a 32-bit
-2^31, which R reserves forNA. Carriesn, how many.zuproto_unknown_enumEnum numbers the enum does not define became
NA. Carriesn.
Examples
pool <- proto_pool()
tryCatch(
proto_fields(pool, "no.such.Message"),
zuproto_unknown_type = function(e) e$type
)
#> [1] "no.such.Message"