codes

package
v0.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 25, 2026 License: Apache-2.0 Imports: 0 Imported by: 0

Documentation

Overview

Package codes defines error codes for API errors and their retry semantics.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Code

type Code uint32

Code is a numeric code for an error.

const (
	// Unknown indicates an error that cannot be classified.
	//
	// This code might be used for malformed error responses or error responses
	// using an error code that cannot be mapped to a code in this package.
	Unknown Code = iota

	// OK indicates the operation completed successfully.
	OK

	// Canceled indicates the operation was canceled (typically by the caller).
	Canceled

	// InvalidArgument indicates the client specified an invalid argument.
	//
	// By contrast with FailedPrecondition, InvalidArgument indicates arguments
	// that are problematic regardless of the state of the system. For example,
	// a malformed request parameter.
	InvalidArgument

	// DeadlineExceeded means the operation expired before completion.
	//
	// For operations that modify the state of the system, this error may be
	// returned even if the operation has completed successfully. For
	// example, a successful response from a server could have been delayed
	// long enough for the deadline to expire.
	DeadlineExceeded

	// NotFound means a requested entity (e.g. a resource or a file) was
	// not found.
	NotFound

	// AlreadyExists means an attempt to create an entity failed because one
	// already exists.
	AlreadyExists

	// PermissionDenied indicates the caller does not have permission to
	// execute the specified operation.
	//
	// This is different from an error returned when the user has exhausted
	// some resource (e.g. too many requests) which is a ResourceExhausted
	// error.
	PermissionDenied

	// ResourceExhausted indicates some resource has been exhausted, perhaps
	// a per-user quota, or perhaps the entire file system is out of space.
	ResourceExhausted

	// FailedPrecondition indicates the operation was rejected because the
	// system is not in a state required for the operation's execution.
	// For example, directory to be deleted may be non-empty, an rmdir
	// operation is applied to a non-directory, etc.
	FailedPrecondition

	// Aborted indicates the operation was aborted, typically due to a
	// concurrency issue like sequencer check failures, transaction aborts,
	// etc.
	Aborted

	// OutOfRange means the operation was attempted past the valid range.
	// E.g., seeking or reading past end of file.
	//
	// Unlike InvalidArgument, this error indicates a problem that may
	// be fixed if the system state changes. For example, a 32-bit file
	// system will generate InvalidArgument if asked to read at an
	// offset that is not in the range [0,2^32-1], but it will generate
	// OutOfRange if asked to read from an offset past the current
	// file size.
	//
	// There is a fair bit of overlap between FailedPrecondition and
	// OutOfRange. We recommend using OutOfRange (the more specific
	// error) when it applies so that callers who are iterating through
	// a space can easily look for an OutOfRange error to detect when
	// they are done.
	OutOfRange

	// Unimplemented indicates the operation is not implemented or not
	// supported/enabled in this service.
	Unimplemented

	// Internal indicates an internal error. This means some invariants
	// expected by the underlying system have been broken. If you see
	// this error, something is very broken.
	Internal

	// Unavailable indicates the service is currently unavailable.
	//
	// This is most likely a transient condition and may be corrected by
	// retrying. Though, this might not always be safe to retry if the
	// operation is non-idempotent.
	//
	// The Databricks SDK will generally automatically retry the request
	// with a backoff when encountering this error.
	Unavailable

	// DataLoss indicates unrecoverable data loss or corruption.
	DataLoss

	// Unauthenticated indicates the request does not have valid
	// authentication credentials for the operation.
	Unauthenticated
)

func FromString

func FromString(s string) Code

FromString converts a string representation of an error code to its corresponding Code value. If the string does not match any known code, Unknown is returned.

func (Code) String

func (c Code) String() string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL