mirror of
https://github.com/go-sylixos/elvish.git
synced 2024-12-13 01:47:51 +08:00
Print causes when pprinting PipelineError.
This commit is contained in:
parent
7527e90f06
commit
216dad636e
|
@ -37,13 +37,20 @@ func (exc *Exception) Pprint(indent string) string {
|
|||
msg = "\033[31;1m" + exc.Cause.Error() + "\033[m"
|
||||
}
|
||||
fmt.Fprintf(buf, "Exception: %s\n", msg)
|
||||
buf.WriteString("Traceback:")
|
||||
buf.WriteString(indent + "Traceback:")
|
||||
|
||||
for tb := exc.Traceback; tb != nil; tb = tb.Next {
|
||||
buf.WriteString("\n" + indent + " ")
|
||||
tb.Pprint(buf, indent+" ")
|
||||
}
|
||||
|
||||
if pipeExcs, ok := exc.Cause.(PipelineError); ok {
|
||||
buf.WriteString("\n" + indent + "Caused by:")
|
||||
for _, e := range pipeExcs.Errors {
|
||||
buf.WriteString("\n" + indent + " " + e.Pprint(indent+" "))
|
||||
}
|
||||
}
|
||||
|
||||
return buf.String()
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user