From 14eed26c26626338a034e7a002d85d9b4f68b5a8 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 783b36ac1512..a9c4f83cd5c5 100644 --- a/core/commands/dag/dag.go +++ b/core/commands/dag/dag.go @@ -239,15 +239,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, )