Documentation
¶
Index ¶
- func GetStackTrace() string
- func Is(err error) bool
- func Wrap(err error) error
- type Ex
- func (e *Ex) Class() string
- func (e *Ex) Decompose() map[string]interface{}
- func (e *Ex) Error() string
- func (e *Ex) Format(s fmt.State, verb rune)
- func (e *Ex) Inner() error
- func (e *Ex) MarshalJSON() ([]byte, error)
- func (e *Ex) Message() string
- func (e *Ex) Stack() StackTrace
- func (e *Ex) StackString() string
- func (e *Ex) WithClass(class string) Exception
- func (e *Ex) WithInner(err error) Exception
- func (e *Ex) WithMessagef(format string, args ...interface{}) Exception
- func (e *Ex) WithStack(stack StackTrace) Exception
- type Exception
- type Frame
- type StackPointers
- type StackStrings
- type StackTrace
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetStackTrace ¶
func GetStackTrace() string
GetStackTrace is a utility method to get the current stack trace at call time.
Types ¶
type Ex ¶
type Ex struct {
// contains filtered or unexported fields
}
Ex is an error with a stack trace.
func (*Ex) Decompose ¶
Decompose breaks the exception down to be marshalled into an intermediate format.
func (*Ex) Format ¶
Format allows for conditional expansion in printf statements based on the token and flags used.
%+v : class + message + stack %v, %c : class %m : message %t : stack
func (*Ex) MarshalJSON ¶
MarshalJSON is a custom json marshaler.
func (*Ex) Stack ¶
func (e *Ex) Stack() StackTrace
Stack returns the stack provider. This is typically the runtime []uintptr or []string if restored after the fact.
func (*Ex) StackString ¶
StackString returns the stack trace as a string.
func (*Ex) WithMessagef ¶
WithMessagef sets the message based on a format and args, and returns the exception.
type Exception ¶
type Exception interface {
error
fmt.Formatter
json.Marshaler
WithClass(string) Exception
Class() string
WithMessagef(string, ...interface{}) Exception
Message() string
WithInner(error) Exception
Inner() error
WithStack(StackTrace) Exception
Stack() StackTrace
Decompose() map[string]interface{}
}
Exception is an exception.
func New ¶
func New(classArgs ...interface{}) Exception
New returns a new exception with a call stack.
func NewFromErr ¶
NewFromErr returns a new exception from an error.
type Frame ¶
type Frame uintptr
Frame represents a program counter inside a stack frame.
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 path of source file relative to the compile time GOPATH %+v equivalent to %+s:%d
type StackPointers ¶
type StackPointers []uintptr
StackPointers is stack of uintptr stack frames from innermost (newest) to outermost (oldest).
func (StackPointers) Format ¶
func (st StackPointers) Format(s fmt.State, verb rune)
Format formats the stack trace.
func (StackPointers) MarshalJSON ¶
func (st StackPointers) MarshalJSON() ([]byte, error)
MarshalJSON is a custom json marshaler.
func (StackPointers) Strings ¶
func (st StackPointers) Strings() []string
Strings dereferences the StackTrace as a string slice
type StackStrings ¶
type StackStrings []string
StackStrings represents a stack trace as string literals.
func (StackStrings) Format ¶
func (ss StackStrings) Format(s fmt.State, verb rune)
Format formats the stack trace.
func (StackStrings) MarshalJSON ¶
func (ss StackStrings) MarshalJSON() ([]byte, error)
MarshalJSON is a custom json marshaler.
func (StackStrings) Strings ¶
func (ss StackStrings) Strings() []string
Strings returns the stack strings as a string slice.
type StackTrace ¶
StackTrace is a stack trace provider.