Skip to content

Commit c6c5c3a

Browse files
committed
catch panic from decodeLogFunc
1 parent f757184 commit c6c5c3a

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

internal/common/log.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,15 @@ func DecodeLogs(chainId string, logs []Log) []*DecodedLog {
112112
for idx, eventLog := range logs {
113113
wg.Add(1)
114114
go func(idx int, eventLog Log, mut *sync.Mutex) {
115+
defer func() {
116+
if err := recover(); err != nil {
117+
log.Error().
118+
Any("chainId", chainId).
119+
Any("Logs", logs).
120+
Err(fmt.Errorf("%v", err)).
121+
Msg("Caught panic in DecodeLogs, possibly in decodeLogFunc")
122+
}
123+
}()
115124
defer wg.Done()
116125
decodedLog := decodeLogFunc(&eventLog, mut)
117126
decodedLogs[idx] = decodedLog

0 commit comments

Comments
 (0)