From 2fb3fae61f05e96f5fe94206da2d6e75edda5fed Mon Sep 17 00:00:00 2001 From: Jon Lundy Date: Wed, 11 Jan 2023 22:06:56 -0700 Subject: [PATCH] fix: not found on create --- ev.go | 2 +- ev_test.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/ev.go b/ev.go index 6898879..ff419c2 100644 --- a/ev.go +++ b/ev.go @@ -335,7 +335,7 @@ func Create[A any, T PA[A]](ctx context.Context, es *EventStore, streamID string attribute.String("agg.streamID", streamID), ) - if err = es.Load(ctx, agg); err != nil { + if err = es.Load(ctx, agg); err != nil && !errors.Is(err, ErrNotFound){ return } diff --git a/ev_test.go b/ev_test.go index 91a9030..627d8f4 100644 --- a/ev_test.go +++ b/ev_test.go @@ -94,7 +94,7 @@ func TestES(t *testing.T) { thing := &Thing{Name: "time"} err = store.Load(ctx, thing) - is.NoErr(err) + is.True(errors.Is(err, ev.ErrNotFound)) t.Log(thing.StreamVersion(), thing.Name, thing.Value)