Skip to content

Commit

Permalink
feat: error with stack on %#v (#461)
Browse files Browse the repository at this point in the history
Print the error with stack when using %#v.

Fixes #363
  • Loading branch information
stevenh committed Nov 27, 2022
1 parent c4b9430 commit f76dda1
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions error.go
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,12 @@ func (err Error) String() string {
return err.formatWithStack()
}

// GoString returns a description of the error and a trace of where the
// error occurred. Printing with %#v will trigger this behaviour.
func (err Error) GoString() string {
return err.formatWithStack()
}

func (err _error) describe(format string, in ...interface{}) string {
return fmt.Sprintf(format, in...)
}
Expand Down

0 comments on commit f76dda1

Please sign in to comment.