Documentation
¶
Overview ¶
Package errors implements functions to manipulate errors.
Example (StackTraceFormatting) ¶
package main import ( "fmt" "github.com/komuw/ong/errors" ) const expectedUser = "admin" func login(user string) error { if user == expectedUser { return nil } return errors.New("invalid user") } func main() { err := login("badGuy") fmt.Printf("%+v", err) }
Output:
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func New ¶
New returns an error with the supplied message. It also records the stack trace at the point it was called.
Error values implement fmt.Formatter and can be formatted by the fmt package. The following verbs are supported:
%s print the error. %v see %s %+v print the error and stacktrace.
func StackTrace ¶
StackTrace returns the stack trace contained in err, if any, else an empty string.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.