[PD1] Error handling project-wide
This commit is contained in:
parent
f5b3726673
commit
b918211736
13 changed files with 364 additions and 245 deletions
|
@ -2,7 +2,6 @@ package networking
|
|||
|
||||
import (
|
||||
"crypto/tls"
|
||||
"log"
|
||||
)
|
||||
|
||||
|
||||
|
@ -14,11 +13,11 @@ type Client[T any] struct {
|
|||
Connection Connection[T]
|
||||
}
|
||||
|
||||
func NewClient[T any](clientTLSConfigProvider ClientTLSConfigProvider) Client[T] {
|
||||
func NewClient[T any](clientTLSConfigProvider ClientTLSConfigProvider) (Client[T],error) {
|
||||
dialConn, err := tls.Dial("tcp", "localhost:8080", clientTLSConfigProvider.GetClientTLSConfig())
|
||||
if err != nil {
|
||||
log.Panicln("Server connection error:\n",err)
|
||||
return Client[T]{},err
|
||||
}
|
||||
conn := NewConnection[T](dialConn)
|
||||
return Client[T]{Connection: conn}
|
||||
return Client[T]{Connection: conn},nil
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue