feat: dont crash if there is a existing source
This commit is contained in:
parent
0b800ff423
commit
07c70b63c4
@ -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))
|
||||||
|
Reference in New Issue
Block a user