Choose Category
package main import ( "errors" "fmt" ) func main() { _, error := method1() fmt.Printf("%+v", error) } func method1() (int, error) { output, error := nestedMethod() wrappedException := fmt.Errorf("wrapping exception [%w]", error) return output, wrappedException } func nestedMethod() (int, error) { return 2, errors.New("nested exception") }