From 285ba7f94bce59e00d328fd4ec0bcd810480aae3 Mon Sep 17 00:00:00 2001 From: SoXX Date: Mon, 8 Jul 2024 22:15:05 +0200 Subject: [PATCH] feat: dont crash if there is a existing source --- pkg/plug/server.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/pkg/plug/server.go b/pkg/plug/server.go index d77d7ec..c416159 100644 --- a/pkg/plug/server.go +++ b/pkg/plug/server.go @@ -2,7 +2,9 @@ package plug import ( "context" + "errors" "fmt" + otterError "git.dragse.it/anthrove/otter-space-sdk/v2/pkg/error" "log" "net" @@ -41,7 +43,9 @@ func (p *Plug) Listen() error { log.Printf("initilazing source!") err = p.database.CreateSource(p.ctx, &p.source) if err != nil { - return err + if !errors.Is(err, &otterError.NoDataWritten{}) { + log.Panic(err) + } } lis, err := net.Listen("tcp", fmt.Sprintf("%s:%s", p.address, p.port))