status

package
v0.2.15 Latest Latest
Warning

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

Go to latest
Published: Sep 8, 2026 License: MIT Imports: 1 Imported by: 0

Documentation

Overview

Package status defines the handwritten RPC status type shared by the driver and application protocol packages.

The code table mirrors the Status enum in proto/cloudpath/v1/*.proto. No generated code and no third-party dependencies are used anywhere in sdk/go.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CodeString

func CodeString(c Code) string

CodeString returns the stable wire name for c, or "UNKNOWN".

Types

type Code

type Code uint32

Code identifies an RPC/stream terminal state. Values are stable across transports and must not be renumbered.

const (
	CodeOK Code = 0
	// CodeCanceled means the operation was canceled, usually by the caller.
	CodeCanceled Code = 1
	// CodeUnknown is used when the error does not fit another code.
	CodeUnknown Code = 2
	// CodeInvalidArgument indicates malformed or semantically invalid input.
	CodeInvalidArgument Code = 3
	// CodeDeadlineExceeded means the operation finished after its deadline.
	CodeDeadlineExceeded Code = 4
	// CodeNotFound means the referenced entity does not exist.
	CodeNotFound Code = 5
	// CodeAlreadyExists means the idempotency/conflict key already exists.
	CodeAlreadyExists Code = 6
	// CodePermissionDenied means the plugin exceeded its granted permissions.
	CodePermissionDenied Code = 7
	// CodeResourceExhausted indicates rate/size/queue limits were hit.
	CodeResourceExhausted Code = 8
	// CodeFailedPrecondition indicates the system is not in a required state.
	CodeFailedPrecondition Code = 9
	// CodeAborted indicates a concurrency/retry conflict.
	CodeAborted Code = 10
	// CodeOutOfRange indicates a numeric range violation.
	CodeOutOfRange Code = 11
	// CodeUnimplemented means the method is not implemented by this plugin.
	CodeUnimplemented Code = 12
	// CodeInternal is a plugin-internal failure.
	CodeInternal Code = 13
	// CodeUnavailable means the transport/plugin is currently unreachable.
	CodeUnavailable Code = 14
	// CodeDataLoss indicates unrecoverable data loss.
	CodeDataLoss Code = 15
	// CodeUnauthenticated indicates a missing/invalid launch identity.
	CodeUnauthenticated Code = 16
)

type Status

type Status struct {
	Code    Code   `json:"code"`
	Message string `json:"message,omitempty"`
}

Status is the wire and error representation of a terminal state.

func Errorf

func Errorf(code Code, format string, args ...any) *Status

Errorf builds an error status with a formatted message.

func New

func New() *Status

New returns an OK status.

func (*Status) Error

func (s *Status) Error() string

Error implements error.

func (*Status) IsOK

func (s *Status) IsOK() bool

IsOK reports whether s is nil or carries CodeOK.

Jump to

Keyboard shortcuts

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