Documentation ¶
Overview ¶
Package errors implements functions to manipulate errors.
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func New ¶
New returns new app error that formats as the given text.
Example ¶
package main import ( "fmt" "github.com/vardius/go-api-boilerplate/pkg/errors" ) func main() { err := errors.New("example") fmt.Printf("%s\n", err) }
Output: example: /home/travis/gopath/src/github.com/vardius/go-api-boilerplate/pkg/errors/example_test.go:10
func Wrap ¶
Wrap returns new app error wrapping target error. If passed value is nil will fallback to internal
Example ¶
package main import ( "fmt" "github.com/vardius/go-api-boilerplate/pkg/errors" ) func main() { subErr := errors.New("example") err := errors.Wrap(subErr) fmt.Printf("%s\n", err) }
Output: /home/travis/gopath/src/github.com/vardius/go-api-boilerplate/pkg/errors/example_test.go:21 example: /home/travis/gopath/src/github.com/vardius/go-api-boilerplate/pkg/errors/example_test.go:20
Types ¶
type AppError ¶
type AppError struct {
// contains filtered or unexported fields
}
func (*AppError) StackTrace ¶
StackTrace returns the string representation of the error stack trace, includeTrace appends caller pcs frames to each error message if possible.
Click to show internal directories.
Click to hide internal directories.