mirror of
https://github.com/robertkrimen/otto.git
synced 2025-12-24 12:58:05 +08:00
feat: error with stack on %#v (#461)
Print the error with stack when using %#v. Fixes #363
This commit is contained in:
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...)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user