diff --git a/pkg/engine/engine.go b/pkg/engine/engine.go index 7b0f87feb..5b6999021 100644 --- a/pkg/engine/engine.go +++ b/pkg/engine/engine.go @@ -397,14 +397,9 @@ func reformatExecErrorMsg(filename string, err error) error { } else { return err } - if len(fileLocations) > 0 { - lastErr := fileLocations[len(fileLocations)-1] - if lastErr == traceable { - current = errors.Unwrap(current) - continue - } + if len(fileLocations) == 0 || fileLocations[len(fileLocations)-1] != traceable { + fileLocations = append(fileLocations, traceable) } - fileLocations = append(fileLocations, traceable) current = errors.Unwrap(current) }