improve gerror.Stack

This commit is contained in:
jflyfox 2020-12-29 14:28:26 +08:00
parent 662f1ed6b7
commit 4beeeb92ac

View File

@ -199,7 +199,7 @@ func Cause(err error) error {
}
// Stack returns the stack callers as string.
// It returns an empty string if the <err> does not support stacks.
// It returns the error string directly if the <err> does not support stacks.
func Stack(err error) string {
if err == nil {
return ""
@ -207,7 +207,7 @@ func Stack(err error) string {
if e, ok := err.(apiStack); ok {
return e.Stack()
}
return ""
return err.Error()
}
// Current creates and returns the current level error.