From af35adb6769059473802a582e8252afc5e924009 Mon Sep 17 00:00:00 2001 From: Ivan Schasny <31857042+ischasny@users.noreply.github.com> Date: Wed, 29 Nov 2023 15:46:35 +0000 Subject: [PATCH] fix: better formatting for error messages (#1833) --- lib/mpoolmonitor/mpoolmonitor.go | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/lib/mpoolmonitor/mpoolmonitor.go b/lib/mpoolmonitor/mpoolmonitor.go index a087c8cf1..9d07f00ce 100644 --- a/lib/mpoolmonitor/mpoolmonitor.go +++ b/lib/mpoolmonitor/mpoolmonitor.go @@ -188,11 +188,17 @@ func (mm *MpoolMonitor) MsgExecElapsedEpochs(ctx context.Context, msgCid cid.Cid x, err := mm.fullNode.StateSearchMsg(ctx, types.EmptyTSK, msgCid, abi.ChainEpoch(20), true) // check for nil is required as the StateSearchMsg / ChainHead sometimes return a nil pointer // without an error (TODO: investigate) that has caused panics in boost - if x == nil || err != nil { + if x == nil { + return found, 0, fmt.Errorf("Message not yet found in state store") + } + if err != nil { return found, 0, fmt.Errorf("searching message: %w", err) } c, err := mm.fullNode.ChainHead(ctx) - if c == nil || err != nil { + if c == nil { + return found, 0, fmt.Errorf("chain head is nil") + } + if err != nil { return found, 0, fmt.Errorf("getting chain head: %w", err) } return found, c.Height() - x.Height, nil