Skip to main content
Failed requests to the service return an error that wraps one of the typed errors below, chosen from the HTTP status code. Match them with errors.As, or match the shared cyborgdb.Error interface.

Error types

All eight implement cyborgdb.Error. A 2xx response whose body can’t be decoded returns the decoding error unchanged, not a typed error. Methods such as CreateIndex add context to the message (for example failed to create index: ...), so always match with errors.As or errors.Is, never by comparing the error directly.

The Error interface

Unwrap makes standard checks work through the chain, for example errors.Is(err, context.DeadlineExceeded) on a *TransportError caused by a context deadline.

Retries

The SDK does not retry requests, and its HTTP client has no timeout: set deadlines on ctx. Retryable() marks the errors that are safe to retry; the retry loop is up to the caller:

Errors returned before a request is sent

Argument checks that run in the SDK return a *ValidationError (with StatusCode() 0) wrapping a sentinel error, so both errors.As and errors.Is work:
Other sentinels are returned without a typed wrapper: ErrKeyGeneration from GenerateKey, and the ErrUnknownSampleDataset / ErrSampleDatasetDownload / ErrSampleDatasetTooLarge / ErrSampleDatasetIntegrity errors from LoadSampleDataset.
The package also declares ErrQueryVectorsInvalidType, ErrMissingQueryInput, and ErrUnexpectedTrainingStatus, but no function returns them. A query with no input is rejected by the service instead, as a *ValidationError with status 400.