fix: add stack trace when errors happen in segments

relates to #1182
This commit is contained in:
Jan De Dobbeleer 2021-11-12 08:40:08 +01:00 committed by Jan De Dobbeleer
parent 9dbe35e1ff
commit 18a3b82dd1

View file

@ -3,6 +3,7 @@ package main
import (
"errors"
"fmt"
"runtime/debug"
"time"
)
@ -284,7 +285,7 @@ func (segment *Segment) setStringValue(env environmentInfo) {
return
}
// display a message explaining omp failed(with the err)
message := fmt.Sprintf("oh-my-posh fatal error rendering %s segment:%s", segment.Type, err)
message := fmt.Sprintf("\noh-my-posh fatal error rendering %s segment:%s\n\n%s\n", segment.Type, err, debug.Stack())
fmt.Println(message)
segment.stringValue = "error"
segment.active = true