Documentation
¶
Index ¶
- Variables
- func Json(unknown error) string
- func String(unknown error) string
- type Error
- func (e *Error) Add(key string, value interface{}) *Error
- func (e *Error) Clone() *Error
- func (e *Error) DeepClone() *Error
- func (e *Error) Error() string
- func (e *Error) GetMeta() []string
- func (e *Error) GetStack() []string
- func (e *Error) String() string
- func (e *Error) Trace(err error) *Error
- func (e *Error) Tracef(message string, a ...interface{}) *Error
- type Frame
- type SerializableError
- type TraceableError
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // Max callstack depth to return PcSize = 10 // 1 for trace(), 1 for err.Trace() CallersToSkip = 2 )
Functions ¶
Types ¶
type Error ¶
type Error struct {
Name string `json:"name"`
Message string `json:"message"`
Meta map[string]interface{} `json:"meta"`
Stack []Frame `json:"stack"`
}
Struct representing an error.
func Guarantee ¶
Create a new instance of `Error` from an error
If `unknown` is of type `Error`, it returns a clone
func (*Error) Add ¶
Attaches a named value to the metadata of the error.
Note: values will eventually get casted into string with `fmt.Sprintf("%+v", value)`.
func (*Error) DeepClone ¶ added in v0.1.6
Creates a deep-copied clone of the Error including stack trace.
func (*Error) Error ¶
Returns superficial information about the error (name and message).
Required to satisfy the error interface.
type Frame ¶ added in v0.1.1
type Frame struct {
Function string `json:"function"`
Line int `json:"line"`
File string `json:"file"`
}
Struct containing information about a stackframe
type SerializableError ¶ added in v0.1.4
Click to show internal directories.
Click to hide internal directories.