errors2

package
v1.4.12 Latest Latest
Warning

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

Go to latest
Published: Apr 24, 2020 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Overview

@Time : 2019-11-11 13:43 @Author : zr

Index

Constants

This section is empty.

Variables

View Source
var (
	//功能集
	U = Utils{}
)

Functions

This section is empty.

Types

type ErrorType

type ErrorType struct {
	ShowMsg  string
	DebugMsg string
	// contains filtered or unexported fields
}

func (*ErrorType) Equal added in v1.1.2

func (e *ErrorType) Equal(err error) bool

type StdError

type StdError struct {
	*ErrorType
	// contains filtered or unexported fields
}

func (*StdError) Code

func (s *StdError) Code() int

func (*StdError) DebugMessage

func (s *StdError) DebugMessage() string

func (*StdError) Error

func (s *StdError) Error() string

func (*StdError) Trace

func (s *StdError) Trace() string

type Utils

type Utils struct {
}

func (Utils) Equal added in v1.1.1

func (Utils) Equal(err error, errorType *ErrorType) bool

func (Utils) FromError

func (Utils) FromError(err error, errorType *ErrorType) (stdErr *StdError)

将error转为*StdError, 若无法转换,则通过error生成一个*StdError,类型为errorType

func (Utils) NewErrorType

func (Utils) NewErrorType(code int, showMsg, debugMsg string) *ErrorType

func (Utils) NewStdError

func (Utils) NewStdError(errorType *ErrorType, debugMsg string) *StdError

生成一个错误

func (Utils) NewStdErrorWarpInFunc added in v1.1.2

func (Utils) NewStdErrorWarpInFunc(errorType *ErrorType, debugMsg string, warpCount int) *StdError

生成一个错误 @warpCount 错误出现位置忽略层级。用于被封装后,在调用堆栈中忽略封装函数名

Jump to

Keyboard shortcuts

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