Java · Errors

Errors

import cloud.unum.usearch.*; 3.0.0-rc.1 · 4c3e5023

Every failure is an unchecked USearchException, since nearly every verb can report one, and its status() is a Status mirroring the C interface’s usearch_status_*_k. Checks the SDK runs before a call crosses report the status the engine would have reported for the same fault, and a code this build cannot name reads as Status.INVALID_ARGUMENT, as in C. Status.DEFERRED is the one non-final status, which only a Deferred reports before its call is final. Any verb on a closed handle raises IllegalStateException instead.

try {
    served.insert(keys, vectors);
} catch (USearchException failure) {
    if (failure.status() != Status.READ_ONLY) {
        throw failure;
}
}

Status, Scalar, DenseMetric, Residency, Traversal and Mood carry their C enumerators’ values in code(), and their toString spells the names the C tables own, so nothing is compared as a string.

API

Types

StatusWhat went wrong, in a vocabulary shared by the engine and by this binding - one enumerator per usearch_status_*_k, the deferred one included, which only a deferred call reports before it is final.
Types.java:254 ↗
enum Status

Validation performed here before a call crosses reports the status the engine would have reported for the same fault.

Fields

SUCCESSThe call succeeded and carries no message.
DEFERREDThe call was submitted deferred and is not final yet; the one non-final status.
OUT_OF_MEMORYAn allocation or reservation could not be satisfied.
SHAPE_MISMATCHDimensionality or row counts disagree.
UNSUPPORTED_LAYOUTA stride or packing the engine cannot traverse.
UNKNOWN_KINDA scalar, metric, or residency tag this build does not know.
READ_ONLYA mutating verb reached a handle that serves its checkpoint in place.
IOA file could not be opened, read, written, or parsed.
DEVICEA device could not be selected, or its memory could not be claimed.
MALFORMEDA caller-supplied representation could not be decoded.
INTERNALThe library reported neither success nor a failure.
OVERFLOWA hard design ceiling was reached, like the 32-bit identity space.
UNINITIALIZEDThe verb needs a prior successful reservation that never happened.
CONFIG_MISMATCHThe request contradicts an already-frozen configuration.
CONTENDEDA synchronization contract was violated - a full deferred table, or a busy arena.
CANCELLEDA progress handler asked the operation to stop; it unwound and published nothing, so the handle carries whatever it did before the call.
UNSUPPORTEDThe verb is declared for every residency but this one does not implement it.
INVALID_ARGUMENTAn argument breaks the verb's contract, like a required one left null, or a status no build names.
USearchExceptionOne failed call: a status every caller can branch on, and the detail the status cannot carry.
Types.java:328 ↗
class USearchException

Nearly every verb can report one, so it is unchecked.