diff --git a/server.go b/server.go index 1151dfc..e0b035a 100644 --- a/server.go +++ b/server.go @@ -47,7 +47,7 @@ func (s *server) Start() error { s.sh.Validate() if s.stopChan != nil { - logging.Logger().Panic("Server: server is already running. Stop it before starting it again") + return fmt.Errorf("Server: server is already running. Stop it before starting it again") } s.httpServer = &fasthttp.Server{ @@ -73,7 +73,7 @@ func (s *server) Start() error { s.ctx = s.sh.ServerContext() if err = s.sh.Init(s.ctx); nil != err { - logging.Logger().Panic(fmt.Sprintf("Server: Initialization of server has been failed %v", err)) + return fmt.Errorf("Server: Initialization of server has been failed %v", err) } var listener net.Listener @@ -92,7 +92,8 @@ func (s *server) Start() error { func (s *server) Stop() { if s.stopChan == nil { - logging.Logger().Panic("Server: server must be started before stopping it") + logging.Logger().Warn("Server: server must be started before stopping it") + return } close(s.stopChan) s.stopWg.Wait()