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:
parent
c4b94300e3
commit
f76dda1760
6
error.go
6
error.go
|
@ -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...)
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user