errorx

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Mar 5, 2023 License: GPL-3.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	/*
		ErrorX cli errors
	*/
	ErrPrintAndExit    = errors.New("print and exit")
	ErrNoInputConfig   = errors.New("have no input config")
	ErrNoInputFilepath = errors.New("have no input filepath")

	/*
		ErrorX runtime errors
	*/
	ErrPackageLogsFailed = errors.New("package logs failed")

	/*
		ErrorX internal errors
	*/
	ErrConfigInvalid             = errors.New("config invalid")
	ErrEnvKeyInvalid             = errors.New("env key invalid")
	ErrEnvLookupFailed           = errors.New("env lookup failed")
	ErrRevisionNotCommit         = errors.New("revision not commit")
	ErrSnapshotNotFoundStatusSet = errors.New("snapshot not found status set")

	/*
		ErrorX file errors
	*/
	ErrFileNotExisted   = errors.New("file not existed")
	ErrFileHasExisted   = errors.New("file has existed")
	ErrFileTypeNotMatch = errors.New("file type not match")
)

TODO error 标准化,最后需要整理一下

Functions

func IsErrorX

func IsErrorX(err error, c ...ErrorCode) bool

func NewErrorX

func NewErrorX(errorCode ErrorCode, errorMsg string) error

Types

type ErrorCode

type ErrorCode int64
const (
	ErrorCode_I_SUCCEEDED ErrorCode = 0
	ErrorCode_W_CLI       ErrorCode = -1
	ErrorCode_E_RUNTIME   ErrorCode = -2
	ErrorCode_E_INTERNAL  ErrorCode = -3
	ErrorCode_E_FILE      ErrorCode = -4
)

ErrorCode I: Info, W: Warn, E: Error

type ErrorX

type ErrorX interface {
	error
	GetErrorCode() ErrorCode
	GetErrorMsg() string
}

func AsErrorX

func AsErrorX(err error) (ErrorX, bool)

Jump to

Keyboard shortcuts

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