The SDK checks your input before it sends anything, so most mistakes throw a specific error with a message that names the problem. Check for one with instanceof. Errors from the node arrive as EntityMutationError for writes and QueryError for queries.
Every error below is exported from @arkiv-network/sdk, except the three query errors, which come from @arkiv-network/sdk/query.
| Error | Thrown when |
|---|
EntityMutationError | The transaction failed or reverted, for example because the account isn’t the owner or has no tGLM. txHash holds the transaction, if it was sent |
SchemaMismatchError | A value is missing, names a column the schema doesn’t have, or has the wrong type |
InvalidValueError | A value doesn’t fit its type: out of range, wrong length, bad checksum, too many decimal places |
UntypedValueError | A value is neither a typed value nor a plain boolean, number, bigint, string or Uint8Array |
MissingValueError | A value is null. Leave the column out, or unset it in a patch |
EntityTooLargeError | The bytes values of one create or patch add up to more than 128 KiB |
EmptyPatchError | A patch has nothing to set or unset |
ConflictingMutationError | A patch sets and unsets the same column |
InvalidExpiryError | An expiration is in the past, longer than the maximum lifetime of about 182 days, or not a whole number of blocks |
InvalidCreationFlagsError | A creation flag isn’t a boolean |
InvalidSaltError | A salt is negative or wider than 128 bits |
NoRandomSourceError | The runtime has no crypto.getRandomValues to make a random salt |
| Error | Thrown when |
|---|
NoEntityFoundError | getEntity found no live entity with the key. entityKey holds the key |
SchemaMismatchError | An entity read through a schema lacks a selected required column, holds a value of another type, or has another schema’s tag. Thrown by getEntity, and by a query with onMismatch: "throw". Queries skip such entities by default |
UnknownAttributeTypeError | The node returned an attribute type this SDK version can’t decode. Update the SDK |
InvalidPredicateError | A condition names an attribute that isn’t an indexed column of the schema, a sort key names a bytes column or one the schema doesn’t have, either uses the wrong type, between has bounds of two types, a sort key has no type in a query without a schema, orderBy gets more than one key, or the query has no condition at all |
UnsupportedOperatorError | startsWith was given a value that isn’t a str |
QueryError | The node rejected the query. kind says why: see query language errors |
| Error | Thrown when |
|---|
MissingAccessKeyError | rabdi was called with an invalid accessKey. Pass a key, or "" for the rate-limited public RPC |
| Error | Thrown when |
|---|
InvalidAttributeNameError | A column name breaks the naming rules |
SchemaDefinitionError | The schema name isn’t a valid str, an entry isn’t a column, or a column is named arkiv.schema |
TooManyAttributesError | A schema has more columns than one entity can hold |