From c55c459f395b4221ae873889d3ee4f014714f785 Mon Sep 17 00:00:00 2001 From: crusader Date: Fri, 1 Dec 2017 22:14:47 +0900 Subject: [PATCH] ing --- server.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/server.go b/server.go index 81d5cdf..8fc1409 100644 --- a/server.go +++ b/server.go @@ -43,13 +43,13 @@ func (s *server) Start() error { s.sh.Validate() if s.stopChan != nil { - 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") } var err 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) } if s.listener, err = s.sh.Listen(s.ctx); nil != err { @@ -66,7 +66,8 @@ func (s *server) Start() error { func (s *server) Stop() { if s.stopChan == nil { - 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()