Documentation ¶
Index ¶
- func Cause(err error, cause error) error
- func Context(err error, ctx string) error
- func Details(err error) map[string]string
- func EOF(err error) bool
- func Equal(err1, err2 error) bool
- func Format(f string, val ...interface{}) error
- func Here(orig error) error
- func Print(err error, out io.Writer)
- func Show(err error)
- func Subject(err error, sub interface{}) error
- func Trace(err error) error
- func Unwrap(err error) error
- type CauseError
- type ContextError
- type ErrorString
- type HereError
- type SubjectError
- type TraceError
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Details ¶
Derive a map of detailed information about an error. For HereErrors, map includes a "location" key For CauseErrors, map includes one or more "cause" keys For TraceErrors, map includes a "trace" key For ContextErrors, map includes a "context" key For SubjectErrors, map includes a "subject" key
func Print ¶
Print out the information within err to out. This understands errors that use Here, Cause, and Trace.
Types ¶
type CauseError ¶
type CauseError struct {
// contains filtered or unexported fields
}
Contains 2 errors, an updated error and a causing error
type ContextError ¶
type ContextError struct {
// contains filtered or unexported fields
}
Adds a string describing the context of this error without changing the underlying error itself.
func (*ContextError) Context ¶
func (c *ContextError) Context() string
func (*ContextError) Error ¶
func (c *ContextError) Error() string
Return a string containing the context as well as the underlying error
type ErrorString ¶
type ErrorString struct {
// contains filtered or unexported fields
}
ErrorString is a trivial implementation of error.
func (*ErrorString) Error ¶
func (e *ErrorString) Error() string
type HereError ¶
type HereError struct {
// contains filtered or unexported fields
}
HereError wraps another error with location information
func (*HereError) FullLocation ¶
Return the full path and line information for the location
type SubjectError ¶
type SubjectError struct {
// contains filtered or unexported fields
}
Attaches a subject to an error. An example would be failing to open a file, the path of the file could be added as the subject to be shown or retrieved later.
func (*SubjectError) Error ¶
func (c *SubjectError) Error() string
Return a string containing the context as well as the underlying error This uses fmt.Sprintf's %s to convert the subject to a string.
func (*SubjectError) Subject ¶
func (c *SubjectError) Subject() interface{}
Return the subject of the error
type TraceError ¶
type TraceError struct {
// contains filtered or unexported fields
}
Contains an error and a stacktrace