From 50af171c8bac5b2236c7a7fecc7acf210b4ea700 Mon Sep 17 00:00:00 2001 From: "Remi GASCOU (Podalirius)" <79218792+p0dalirius@users.noreply.github.com> Date: Thu, 21 May 2026 10:26:01 +0200 Subject: [PATCH] Fix misleading log message when os.WriteFile fails in export path (#9) Distinguish the JSON serialization error from the file write error so users can tell which stage failed: the first branch now logs "Error serializing graph to JSON" and the second logs "Error writing graph to file ", instead of both reporting "Error exporting graph to file". --- main.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/main.go b/main.go index e79cfdc..80c1db3 100755 --- a/main.go +++ b/main.go @@ -126,12 +126,12 @@ func main() { logger.Info(fmt.Sprintf("Exporting graph to file: %s", outputFile)) jsonData, err := og.ExportJSON(false) if err != nil { - logger.Warn(fmt.Sprintf("Error exporting graph to file: %s", err)) + logger.Warn(fmt.Sprintf("Error serializing graph to JSON: %s", err)) return } err = os.WriteFile(outputFile, []byte(jsonData), 0644) if err != nil { - logger.Warn(fmt.Sprintf("Error exporting graph to file: %s", err)) + logger.Warn(fmt.Sprintf("Error writing graph to file %s: %s", outputFile, err)) return } logger.Info(fmt.Sprintf("Graph exported to file: %s", outputFile))