Choose Category
package main import ( "fmt" errors "github.com/pkg/errors" ) func main() { _, err := method1() fmt.Printf("%+v", err) } func method1() (int, error) { output, error := nestedMethod() wrappedException := errors.Wrap(error, "wrapping error") return output, wrappedException } func nestedMethod() (int, error) { return 2, errors.New("nested exception") }