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/ustore/go/errors.md' | claude -p "How would this fit my code?"Every fallible verb answers an error, a *Error carrying the Status the C ABI reported and the static message beside it, so errors.Is matches it against a bare Status and errors.As reaches the message.
A closed handle is refused with StatusUninitialized before anything crosses, and a batch whose runs disagree in length with StatusInvalidArgument. Status, Durability, Watch, Modality and the other enums print through String and parse through their FromName functions the spellings the C tables own, such as "not-found" or "strict-serializable".
_, err := database.CollectionCreate("people", ustore.ModalityBlobs)
if errors.Is(err, ustore.StatusAlreadyExists) {
fmt.Println(err)
}
fmt.Println(ustore.VersionName()) // the library the program runs against, such as "1.0.0-rc.1"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, in a vocabulary shared by every engine and by this binding.3type Status int32 Validation performed here before a call crosses reports the status the engine would have reported for the same fault.
A Status is an error, so errors.Is matches any failure carrying it against a bare Status.
StatusSuccess | StatusSuccess means the call succeeded and carries no message. | |
|---|---|---|
StatusDeferred | StatusDeferred means the call was submitted deferred and is not final yet. | |
StatusOutOfMemory | StatusOutOfMemory means an allocation could not be satisfied. | |
StatusReadOnly | StatusReadOnly means the call would change a database opened read-only. | |
StatusIO | StatusIO means a file or directory could not be opened, read, written, or closed. | |
StatusDevice | StatusDevice means a device could not be selected or its memory claimed, or the call's executor, database and arena belong to different residencies or devices. | |
StatusMalformed | StatusMalformed means stored or supplied data could not be decoded. | |
StatusInternal | StatusInternal means the engine failed in a way no other status names. | |
StatusOverflow | StatusOverflow means a count passed what its word holds, like the open exports of one arena. | |
StatusUninitialized | StatusUninitialized means the call needs a handle that was never opened or is closed. | |
StatusConfigMismatch | StatusConfigMismatch means the handles or arguments are each well-formed but cannot be joined. | |
StatusContended | StatusContended means the call was refused rather than waited for: another call holds its executor, arena, cursor or transaction. | |
StatusCancelled | StatusCancelled means a progress handler stopped the call, which unwound and published nothing. | |
StatusUnsupported | StatusUnsupported means the engine or build does not implement what the call asks for. | |
StatusInvalidArgument | StatusInvalidArgument means an argument is missing, contradicts another one, or carries a choice the call does not accept. | |
StatusNotFound | StatusNotFound means a collection, a directory, or a document a modification needs does not exist. | |
StatusAlreadyExists | StatusAlreadyExists means a collection name or a document the call creates is already taken. | |
StatusWriteConflict | StatusWriteConflict means a concurrent writer changed a key this transaction wrote. | |
StatusReadConflict | StatusReadConflict means a concurrent writer changed a key this transaction read. | |
StatusPhantomConflict | StatusPhantomConflict means a concurrent writer inserted into a range this transaction scanned. | |
StatusCapacityExhausted | StatusCapacityExhausted means a hard design ceiling was reached. |
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, such as "not-found".func (status Status) String() string