apperr

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Jul 29, 2026 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ExitCode

func ExitCode(err error) int

func Is

func Is(err error, code Code) bool

func IsKnownCode

func IsKnownCode(code Code) bool

func Normalize

func Normalize(err error) error

func NormalizeInto

func NormalizeInto(err *error)

Types

type Code

type Code string
const (
	CodeInternal           Code = "internal"
	CodeInvalidArgument    Code = "invalid_argument"
	CodeNotAuthenticated   Code = "not_authenticated"
	CodeAccessDenied       Code = "access_denied"
	CodeAuthExpired        Code = "authentication_expired"
	CodeNotInitialized     Code = "not_initialized"
	CodeConfigNotFound     Code = "config_not_found"
	CodeEnvironmentMissing Code = "environment_not_found"
	CodeEnvironmentExists  Code = "environment_already_exists"
	CodeSecretMissing      Code = "secret_not_found"
	CodeSecretExists       Code = "secret_already_exists"
	CodeArtifactNotFound   Code = "artifact_not_found"
	CodeConflict           Code = "conflict"
	CodeUnavailable        Code = "unavailable"
)

func CodeOf

func CodeOf(err error) Code

type Error

type Error struct {
	// contains filtered or unexported fields
}

func New

func New(code Code, message string, params Params) *Error

func Wrap

func Wrap(code Code, message string, cause error, params Params) *Error

func (*Error) Code

func (e *Error) Code() Code

func (*Error) Error

func (e *Error) Error() string

func (*Error) Params

func (e *Error) Params() Params

func (*Error) Unwrap

func (e *Error) Unwrap() error

type Params

type Params map[string]string

type Payload

type Payload struct {
	Code    Code   `json:"code"`
	Message string `json:"message"`
	Params  Params `json:"params"`
}

func PayloadOf

func PayloadOf(err error) Payload

Jump to

Keyboard shortcuts

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