From 4c82b15c3672516a1e21bbfa6712aa1f027e6ad7 Mon Sep 17 00:00:00 2001 From: Alex Sharov Date: Mon, 22 Mar 2021 22:45:24 +0700 Subject: [PATCH] no_panic_be_happy (#1586) --- ethdb/kv_lmdb.go | 2 +- ethdb/kv_mdbx.go | 2 +- ethdb/object_db.go | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/ethdb/kv_lmdb.go b/ethdb/kv_lmdb.go index d27847d95..a5c9c477f 100644 --- a/ethdb/kv_lmdb.go +++ b/ethdb/kv_lmdb.go @@ -356,7 +356,7 @@ func (db *LmdbKV) CollectMetrics() { tableGcEntries.Update(int64(stat.Entries)) return nil }); err != nil { - panic(err) + log.Error("collecting metrics failed", "err", err) } } diff --git a/ethdb/kv_mdbx.go b/ethdb/kv_mdbx.go index c65e096f7..73ef758b0 100644 --- a/ethdb/kv_mdbx.go +++ b/ethdb/kv_mdbx.go @@ -344,7 +344,7 @@ func (db *MdbxKV) CollectMetrics() { tableGcEntries.Update(int64(stat.Entries)) return nil }); err != nil { - panic(err) + log.Error("collecting metrics failed", "err", err) } } diff --git a/ethdb/object_db.go b/ethdb/object_db.go index e60e85bd5..9ecf7e2e6 100644 --- a/ethdb/object_db.go +++ b/ethdb/object_db.go @@ -347,7 +347,7 @@ func (db *ObjectDatabase) NewBatch() DbWithPendingMutations { func (db *ObjectDatabase) Begin(ctx context.Context, flags TxFlags) (DbWithPendingMutations, error) { batch := &TxDb{db: db} if err := batch.begin(ctx, flags); err != nil { - panic(err) + return batch, err } return batch, nil }