type Error struct {
Status Status
Message string
} Reach the status with errors.Is or errors.As.
Ask your coding agent about this page, or add the docs server to it
curl -s 'https://www.unum.cloud/docs/uform/go/errors.md' | claude -p "How would this fit my code?"Every fallible call answers an error whose *Error carries a Status and the library’s static Message, and a bare Status is an error too, so errors.Is matches either.
A failure the binding catches before the call crosses the boundary reports the status the library would have used.
encoded, err := model.On(executor).TextEncode(texts, uform.EncodeOutputsEmbeddings, uform.ScalarF32, arena, nil)
switch {
case errors.Is(err, uform.StatusContended):
fmt.Println("the arena serves another call")
case err != nil:
fmt.Println(err)
default:
fmt.Println(encoded.Embeddings.Count(), "items")
}Status carries the C enumerators’ values, and StatusDeferred reaches only Deferred.Status. Status, Scalar, Mood, CPUClass, GPUClass, GPUVendor, Modality, Objective, Negatives, MultimemTier, PairLossForm and LateInteractionSide print the names the C tables own through String, such as "shape-mismatch" or "intel-haswell".
A panic inside a progress handler crashes the process, since it cannot unwind through the library.
ErrorError is one failed call: a status every caller can branch on, and the detail the status cannot carry.2type Error struct {
Status Status
Message string
} Reach the status with errors.Is or errors.As.
ErrorError implements the error interface.func (failure *Error) Error() string UnwrapUnwrap exposes the status, which is what errors.Is compares.func (failure *Error) Unwrap() error StatusStatus names what went wrong, numbered as the C header and USearch number it, so one failure carries one identity across both libraries.3type Status int32 Validation performed here before a call crosses reports the status the library would have reported for the same fault.
A Status is an error, so errors.Is(err, uform.StatusUnsupported) matches any failure carrying it.
StatusSuccess | StatusSuccess means the call completed and carries no message. | |
|---|---|---|
StatusDeferred | StatusDeferred means the call was submitted deferred and is not final yet. | |
StatusOutOfMemory | StatusOutOfMemory means device, pinned or host memory could not be allocated. | |
StatusShapeMismatch | StatusShapeMismatch means item counts, a pixel shape or a batch envelope disagree. | |
StatusUnsupportedLayout | StatusUnsupportedLayout means a stride or packing the model cannot read. | |
StatusUnknownKind | StatusUnknownKind means a scalar, modality or name this build does not know. | |
StatusIO | StatusIO means a checkpoint file could not be opened, read or written. | |
StatusDevice | StatusDevice means the driver refused or the device faulted, or the build carries no GPU. | |
StatusMalformed | StatusMalformed means supplied bytes could not be decoded: a checkpoint, an image, a clip or a recording. | |
StatusInternal | StatusInternal means the library reported neither success nor a failure. | |
StatusOverflow | StatusOverflow means a count would pass the largest value its type holds. | |
StatusUninitialized | StatusUninitialized means the handle the call operates on is closed or was never opened. | |
StatusConfigMismatch | StatusConfigMismatch means the request contradicts a frozen configuration. | |
StatusContended | StatusContended means the call was refused rather than waited for: another call holds its executor or arena. | |
StatusCancelled | StatusCancelled means a progress handler asked the call to stop; it unwound and published nothing. | |
StatusUnsupported | StatusUnsupported means the verb is declared but this residency or model does not implement it, like a modality the model was not trained on. | |
StatusInvalidArgument | StatusInvalidArgument means an argument breaks the verb's contract, like a required value left nil. |
StatusFromNameStatusFromName reads a status back from the spelling Status.String renders.func StatusFromName(name string) (Status, error) ErrorError implements the error interface, so a bare Status is an errors.Is target.func (status Status) Error() string StringString renders the status as the library spells it.func (status Status) String() string