1
0
mirror of https://github.com/robertkrimen/otto synced 2025-10-05 19:19:10 +08:00

feat: error with stack on %#v (#461)

Print the error with stack when using %#v.

Fixes #363
This commit is contained in:
Steven Hartland 2022-11-27 23:12:50 +00:00 committed by GitHub
parent c4b94300e3
commit f76dda1760
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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...)
}