errors

package
v1.4.0 Latest Latest
Warning

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

Go to latest
Published: Sep 5, 2023 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CodeForError

func CodeForError(err error) int32

func IsConflict

func IsConflict(err error) bool

IsConflict TODO: make 409 enum or const

func IsInternalError

func IsInternalError(err error) bool

func IsNotFound

func IsNotFound(err error) bool

func IsTooManyRequests

func IsTooManyRequests(err error) bool

Types

type CauseType

type CauseType string
const (
	StorageMethodCall  CauseType = "call etcd storage method error"
	Marshal            CauseType = "marshal error"
	Unmarshal          CauseType = "unmarshal error"
	AgentStepInstall   CauseType = "agent install step command "
	AgentStepUninstall CauseType = "agent uninstall step command"
	ShellCommand       CauseType = "shell command step error"
	StepLog            CauseType = "step log error"
)

type HTTPError

type HTTPError struct {
	Code    int    `json:"code"`
	Message string `json:"message"`
	Reason  string `json:"reason"`
}

type StatusCause

type StatusCause struct {
	Type    CauseType `json:"reason,omitempty"`
	Message string    `json:"message,omitempty"`
}

func StatusErrorCause

func StatusErrorCause(err error, name CauseType) (StatusCause, bool)

type StatusDetails

type StatusDetails struct {
	AgentID   string        `json:"agent_id,omitempty"`
	Subject   string        `json:"subject,omitempty"`
	Operation int32         `json:"operation,omitempty"`
	Causes    []StatusCause `json:"causes,omitempty"`
}

type StatusError

type StatusError struct {
	Message string         `json:"message,omitempty"`
	Reason  StatusReason   `json:"reason,omitempty"`
	Details *StatusDetails `json:"details,omitempty"`
	// Status number, 0 if not set.
	Code int32 `json:"code,omitempty"`
}

func (*StatusError) Error

func (s *StatusError) Error() string

type StatusReason

type StatusReason string
const (
	StatusReasonUnknown           StatusReason = ""
	StatusReasonStorageMethodCall StatusReason = "call etcd storage method error"
	StatusReasonUnexpected        StatusReason = "unexpected error"
)

Jump to

Keyboard shortcuts

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