Hide position info for warnings when position is unknown (empty query string passed in)

Signed-off-by: Jeanette Tan <jeanette.tan@grafana.com>
This commit is contained in:
Jeanette Tan 2023-10-25 18:10:42 +08:00
parent f2e02c52db
commit 72cc93d225

View file

@ -116,6 +116,9 @@ type annoErr struct {
}
func (e annoErr) Error() string {
if e.Query == "" {
return e.Err.Error()
}
return fmt.Sprintf("%s (%s)", e.Err, e.PositionRange.StartPosInput(e.Query, 0))
}