From 87da842602a3bb1efebe2e8fd7b214044245eb1b Mon Sep 17 00:00:00 2001 From: Varun Gandhi Date: Thu, 29 Sep 2022 20:57:37 +0800 Subject: [PATCH] code-intel: Don't panic on errors in SCIP code paths. --- cmd/src/code_intel_upload_flags.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/cmd/src/code_intel_upload_flags.go b/cmd/src/code_intel_upload_flags.go index 528e4293a2..d802835bdb 100644 --- a/cmd/src/code_intel_upload_flags.go +++ b/cmd/src/code_intel_upload_flags.go @@ -229,20 +229,20 @@ func convertSCIPToLSIFGraph(out *output.Output, inputFile, outputFile string) er data, err := os.ReadFile(inputFile) if err != nil { - panic(err) + return errors.Wrapf(err, "failed to read SCIP index '%s'", inputFile) } index := scip.Index{} err = proto.Unmarshal(data, &index) if err != nil { - panic(errors.Wrapf(err, "failed to parse protobuf file '%s'", inputFile)) + return errors.Wrapf(err, "failed to parse protobuf file '%s'", inputFile) } els, err := scip.ConvertSCIPToLSIF(&index) if err != nil { - panic(errors.Wrapf(err, "failed reader.ConvertTypedIndexToGraphIndex")) + return errors.Wrapf(err, "failed to convert SCIP index at '%s' to LSIF", inputFile) } err = scip.WriteNDJSON(scip.ElementsToJsonElements(els), tmp) if err != nil { - panic(err) + return errors.Wrapf(err, "failed to write LSIF JSON output to '%s'", tmp.Name()) } err = tmp.Close() if err != nil {