errors

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: May 15, 2026 License: MIT Imports: 8 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func As

func As(err error, target any) bool

Implement golang errors.As, finds the first error in err's chain that matches target, and if one is found, sets target to that error value and returns true

func GetCaller

func GetCaller(err error) (string, int, string, error)

func GetCode

func GetCode(err error) codes.Code

func Is

func Is(err error, target error) bool

Implement golang errors.Is, reports whether any error in err's chain matches target.

func NewWithCode

func NewWithCode(code codes.Code, msg string, val ...interface{}) error

func WrapWithCode added in v0.1.0

func WrapWithCode(err error, code codes.Code, msg string, val ...interface{}) error

WrapWithCode wraps an existing error with a new message and error code, preserving the original error as the cause so that errors.Is / errors.As continue to work across the chain.

Types

type App

type App struct {
	Code  codes.Code `json:"code"`
	Title string     `json:"title"`
	Body  string     `json:"body"`
	// contains filtered or unexported fields
}

func Compile

func Compile(err error, lang string) (int, App)

Compile returns an error and creates new App errors

func (*App) Error

func (e *App) Error() string

func (*App) Unwrap added in v0.1.0

func (e *App) Unwrap() error

Unwrap returns the underlying error so that errors.Is and errors.As can traverse the chain through a *App value.

Jump to

Keyboard shortcuts

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