codekit

package
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: Feb 25, 2026 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	OK  = New(0, "OK")
	Err = New(-1, "System Exception")
)

Functions

func Is

func Is(err error, target Code) bool

Is reports whether the err is the target code

Types

type Code

type Code interface {
	error
	// Value returns the code value
	Value() int
	// Message returns the code message
	Message() string
	// WithMsg returns a new Code with the same value but a different message
	WithMsg(msg string) Code
	// WithMsgF returns a new Code with the same value and a formatted message
	WithMsgF(format string, args ...any) Code
}

Code the code definition for API

func FromError

func FromError(err error) Code

FromError returns a Code representation of err.

func New

func New(val int, msg string) Code

Jump to

Keyboard shortcuts

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