Documentation
¶
Index ¶
- Constants
- type Frame
- type StackTrace
- type Status
- func (that *Status) Cause() error
- func (that *Status) Clear()
- func (that *Status) Code() int32
- func (that *Status) Copy(newCause interface{}, newStackSkip ...int) *Status
- func (that *Status) Format(state fmt.State, verb rune)
- func (that *Status) MarshalJSON() ([]byte, error)
- func (that *Status) Msg() string
- func (that *Status) OK() bool
- func (that *Status) SetCases(cause interface{}) *Status
- func (that *Status) SetCode(code int32) *Status
- func (that *Status) SetMsg(msg string) *Status
- func (that *Status) StackTrace() StackTrace
- func (that *Status) String() string
- func (that *Status) TagStack(skip ...int) *Status
- func (that *Status) UnknownError() bool
- func (that *Status) UnmarshalJSON(b []byte) error
Constants ¶
const ( // OK 成功状态 OK int32 = 0 // UnknownError 未知错误 UnknownError int32 = -1 )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Frame ¶
type Frame uintptr
Frame represents a program counter inside a stack frame. For historical reasons if Frame is interpreted as a uintptr its value represents the program counter + 1.
func (Frame) Format ¶
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
func (Frame) MarshalText ¶
MarshalText formats a stacktrace Frame as a text string. The output is the same as that of fmt.Sprintf("%+v", f), but without newlines or tabs.
type StackTrace ¶
type StackTrace []Frame
StackTrace is stack of Frames from innermost (newest) to outermost (oldest).
func PanicStackTrace ¶
func PanicStackTrace() StackTrace
PanicStackTrace gets the panic stack trace.
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.
type Status ¶
type Status struct {
// contains filtered or unexported fields
}
func NewWithStack ¶
NewWithStack 传入错误码,错误消息,错误栈堆,创建一个状态结构对象
func (*Status) UnmarshalJSON ¶
UnmarshalJSON json解码