exceptions

package
v0.0.21-beta.1 Latest Latest
Warning

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

Go to latest
Published: Sep 20, 2023 License: MIT Imports: 5 Imported by: 27

Documentation

Index

Constants

View Source
const (
	ErrCodeFunctionError   = "k_cf_ec_100001" // 函数错误
	ErrCodeValidationError = "k_cf_ec_100002" // 校验错误

	ErrCodeInternalError  = "k_cf_ec_200001" // 内部系统错误
	ErrCodeRateLimitError = "k_cf_ec_200009" // 限流错误

	ErrCodeInvalidParams  = "k_cf_ec_300001" // 请求参数错误
	ErrCodeDeveloperError = "k_cf_ec_300002" // 开发者错误
)

Variables

This section is empty.

Functions

This section is empty.

Types

type BaseError

type BaseError struct {
	Code    string `json:"code"`
	Message string `json:"message"`
	// contains filtered or unexported fields
}

func DeveloperError

func DeveloperError(format string, args ...interface{}) *BaseError

func ErrWrap

func ErrWrap(err error) *BaseError

func InternalError

func InternalError(format string, args ...interface{}) *BaseError

func InvalidParamError

func InvalidParamError(format string, args ...interface{}) *BaseError

func NewErrWithCode

func NewErrWithCode(code, format string, args ...interface{}) *BaseError

func ParseErrForUser

func ParseErrForUser(err error) *BaseError

func (*BaseError) Error

func (e *BaseError) Error() string

func (*BaseError) Format

func (e *BaseError) Format(st fmt.State, verb rune)

type Frame

type Frame uintptr

Frame represents a program counter inside a stack frame.

func (Frame) Format

func (f Frame) Format(s fmt.State, verb rune)

Format formats the frame according to the fmt.Formatter interface.

%s    source file
%d    source line
%n    function name
%v    equivalent to %s:%d

Format accepts flags that alter the printing of some verbs, as follows:

%+s   function name and path of source file relative to the compile time
      GOPATH separated by \n\t (<funcname>\n\t<path>)
%+v   equivalent to %+s:%d

type StackTrace

type StackTrace []Frame

StackTrace is stack of Frames from innermost (newest) to outermost (oldest).

func (StackTrace) Format

func (st StackTrace) Format(s fmt.State, verb rune)

Format formats the stack of Frames according to the fmt.Formatter interface.

%s	lists source files for each Frame in the stack
%v	lists the source file and line number for each Frame in the stack

Format accepts flags that alter the printing of some verbs, as follows:

%+v   Prints filename, function, and line number for each Frame in the stack.

Jump to

Keyboard shortcuts

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