error

package
v0.0.6 Latest Latest
Warning

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

Go to latest
Published: Mar 22, 2022 License: Apache-2.0 Imports: 1 Imported by: 28

Documentation

Index

Constants

View Source
const (
	// Unknown unknown error
	Unknown int64 = -1
	// Internal internal server error
	Internal int64 = -2

	// Success success
	Success int64 = 0
	// ErrParams parameter error
	ErrParams int64 = 1
)

Variables

This section is empty.

Functions

func Translation

func Translation(code int64) string

Translation translation code to message

Types

type Error

type Error struct {
	Code    int64  `json:"code"`
	Message string `json:"msg,omitempty"`
}

Error error

func New

func New(code int64, params ...interface{}) Error

New return error with code and error message

func NewErrorWithString

func NewErrorWithString(code int64, message string) Error

NewErrorWithString return error with code and string message

func (Error) Error

func (e Error) Error() string

Error return error string

type Table

type Table map[int64]string

Table map[code]opywriting

var CodeTable Table

CodeTable error value comparison table

Directories

Path Synopsis
Package errdefiner enable centralized definition of error code.
Package errdefiner enable centralized definition of error code.

Jump to

Keyboard shortcuts

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