Skip to content

Commit d4e9939

Browse files
committed
fix: better formatting for error messages
1 parent 6e412c2 commit d4e9939

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

lib/mpoolmonitor/mpoolmonitor.go

+8-2
Original file line numberDiff line numberDiff line change
@@ -188,11 +188,17 @@ func (mm *MpoolMonitor) MsgExecElapsedEpochs(ctx context.Context, msgCid cid.Cid
188188
x, err := mm.fullNode.StateSearchMsg(ctx, types.EmptyTSK, msgCid, abi.ChainEpoch(20), true)
189189
// check for nil is required as the StateSearchMsg / ChainHead sometimes return a nil pointer
190190
// without an error (TODO: investigate) that has caused panics in boost
191-
if x == nil || err != nil {
191+
if x == nil {
192+
return found, 0, fmt.Errorf("searching message is nil")
193+
}
194+
if err != nil {
192195
return found, 0, fmt.Errorf("searching message: %w", err)
193196
}
194197
c, err := mm.fullNode.ChainHead(ctx)
195-
if c == nil || err != nil {
198+
if c == nil {
199+
return found, 0, fmt.Errorf("chain head is nil")
200+
}
201+
if err != nil {
196202
return found, 0, fmt.Errorf("getting chain head: %w", err)
197203
}
198204
return found, c.Height() - x.Height, nil

0 commit comments

Comments
 (0)