From 043c06e103c99bb88aa3d66a1a01101dc27d408d Mon Sep 17 00:00:00 2001 From: Ardit Marku Date: Thu, 19 Sep 2024 19:37:14 +0300 Subject: [PATCH] Fix error handling for transaction traces --- api/debug.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/api/debug.go b/api/debug.go index bd48f7914..c2b7648a7 100644 --- a/api/debug.go +++ b/api/debug.go @@ -65,8 +65,9 @@ func (d *DebugAPI) TraceBlockByNumber( txTrace, err := d.TraceTransaction(ctx, h, nil) if err != nil { results[i] = &txTraceResult{TxHash: h, Error: err.Error()} + } else { + results[i] = &txTraceResult{TxHash: h, Result: txTrace} } - results[i] = &txTraceResult{TxHash: h, Result: txTrace} } return results, nil @@ -87,8 +88,9 @@ func (d *DebugAPI) TraceBlockByHash( txTrace, err := d.TraceTransaction(ctx, h, nil) if err != nil { results[i] = &txTraceResult{TxHash: h, Error: err.Error()} + } else { + results[i] = &txTraceResult{TxHash: h, Result: txTrace} } - results[i] = &txTraceResult{TxHash: h, Result: txTrace} } return results, nil