From 46d9c8e534458ebabf0f665bd191ab8c0ee4824b Mon Sep 17 00:00:00 2001 From: Marcin Rataj Date: Tue, 13 Jun 2023 19:55:15 +0200 Subject: [PATCH] fix: correct message when root pin failed --- core/commands/dag/dag.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/core/commands/dag/dag.go b/core/commands/dag/dag.go index 7d21eb0710f5..ebb31da3b3c8 100644 --- a/core/commands/dag/dag.go +++ b/core/commands/dag/dag.go @@ -236,15 +236,19 @@ Specification of CAR formats: https://ipld.io/specs/transport/car/ return err } + var rootStatus string if event.Root.PinErrorMsg != "" { + rootStatus = "Error pinning" event.Root.PinErrorMsg = fmt.Sprintf("FAILED: %s", event.Root.PinErrorMsg) } else { + rootStatus = "Pinned root" event.Root.PinErrorMsg = "success" } _, err = fmt.Fprintf( w, - "Pinned root\t%s\t%s\n", + "%s\t%s\t%s\n", + rootStatus, enc.Encode(event.Root.Cid), event.Root.PinErrorMsg, )