internal/worker: make json parsing errors obvious. We directly propagate the err from json.Unmarshall without any context. This makes it difficult to understand that the error message is even coming from a json parsing issue. Change-Id: Iec8a04b48092a079c2b44faf4cbd39cd5ac81ae9 Reviewed-on: https://go-review.googlesource.com/c/pkgsite-metrics/+/702495 Auto-Submit: Markus Kusano <kusano@google.com> Reviewed-by: Ethan Lee <ethanalee@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
diff --git a/internal/worker/analysis.go b/internal/worker/analysis.go index d115f5f..ef78440 100644 --- a/internal/worker/analysis.go +++ b/internal/worker/analysis.go
@@ -308,7 +308,7 @@ } var tree analysis.JSONTree if err := json.Unmarshal(out, &tree); err != nil { - return nil, err + return nil, fmt.Errorf("Unable to parse analyzer's -json diagnostics: %w", err) } return tree, nil }