From af273650391af743e9d232f4db78d46243b7dbe3 Mon Sep 17 00:00:00 2001 From: crusader Date: Fri, 1 Dec 2017 22:13:15 +0900 Subject: [PATCH] ing --- server.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) 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()