From 7dff702a3d42f671be001aa5ee9b4894f02e8746 Mon Sep 17 00:00:00 2001 From: colindickson Date: Thu, 12 Sep 2024 14:38:38 -0400 Subject: [PATCH] Revert "base store: recover from panic" This reverts commit b73bf4504595340745cb7c2fe1a5818cda09ea2e. --- storage/store/base_store.go | 26 +++----------------------- 1 file changed, 3 insertions(+), 23 deletions(-) diff --git a/storage/store/base_store.go b/storage/store/base_store.go index daefab50..d46fa9d0 100644 --- a/storage/store/base_store.go +++ b/storage/store/base_store.go @@ -1,7 +1,6 @@ package store import ( - "errors" "fmt" pbssinternal "github.com/streamingfast/substreams/pb/sf/substreams/intern/v2" @@ -70,32 +69,13 @@ func (b *baseStore) UpdatePolicy() pbsubstreams.Module_KindStore_UpdatePolicy { return b.updatePolicy } -func (b *baseStore) ApplyOps(in []byte) (err error) { - //recover panics (e.g. from store too big panic in ApplyDeltas) - defer func() { - if r := recover(); r != nil { - fmt.Println("Recovered in f", r) - // find out exactly what the error was and set err - switch x := r.(type) { - case string: - err = errors.New(x) - case error: - err = x - default: - // Fallback err (per specs, error strings should be lowercase w/o punctuation - err = errors.New("unknown panic") - } - } - }() - +func (b *baseStore) ApplyOps(in []byte) error { ops := &pbssinternal.Operations{} - if err = proto.Unmarshal(in, ops); err != nil { + if err := proto.Unmarshal(in, ops); err != nil { return err } b.kvOps = ops - err = b.Flush() - - return + return b.Flush() } func (b *baseStore) Flush() error {