codes

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Mar 3, 2025 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	OK      = New(0, "OK")
	Unknown = New(1, "unknown")
)

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
	// V returns the code value
	V() int
	// M returns the code message
	M() string
	// New returns a newly allocated code with the same value.
	New(msg string) Code
}

Code the code definition for API

func New

func New(v int, m string) Code

Jump to

Keyboard shortcuts

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