Skip to content

Commit

Permalink
add DecodeError
Browse files Browse the repository at this point in the history
  • Loading branch information
chzyer committed Oct 10, 2015
1 parent 635fb11 commit cd112f6
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions logex.go
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,16 @@ func sprintf(f string, o []interface{}) string {
return fmt.Sprintf(f, o...)
}

func DecodeError(e error) string {
if e == nil {
return ""
}
if e1, ok := e.(*traceError); ok {
return e1.StackError()
}
return e.Error()
}

func decodeTraceError(o []interface{}) {
if !ShowCode {
return
Expand Down

0 comments on commit cd112f6

Please sign in to comment.