feat: dont crash if there is a existing source
All checks were successful
Gitea Build Check / Build (push) Successful in 9m47s

This commit is contained in:
SoXX 2024-07-08 22:15:05 +02:00
parent 0b800ff423
commit 285ba7f94b

View File

@ -2,7 +2,9 @@ package plug
import ( import (
"context" "context"
"errors"
"fmt" "fmt"
otterError "git.dragse.it/anthrove/otter-space-sdk/v2/pkg/error"
"log" "log"
"net" "net"
@ -41,7 +43,9 @@ func (p *Plug) Listen() error {
log.Printf("initilazing source!") log.Printf("initilazing source!")
err = p.database.CreateSource(p.ctx, &p.source) err = p.database.CreateSource(p.ctx, &p.source)
if err != nil { 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)) lis, err := net.Listen("tcp", fmt.Sprintf("%s:%s", p.address, p.port))