diff --git a/client/client.go b/client/client.go index 0a31a76..0466202 100644 --- a/client/client.go +++ b/client/client.go @@ -62,7 +62,7 @@ func (c *client) Connect() error { c.rwcHandler.Validate() if c.stopChan != nil { - panic("RPC Client: the given client is already started. Call Client.Stop() before calling Client.Start() again!") + return fmt.Errorf("RPC Client: the given client is already started. Call Client.Stop() before calling Client.Start() again") } c.ctx = c.ch.ClientContext(nil) @@ -84,7 +84,8 @@ func (c *client) Connect() error { func (c *client) Close() { if c.stopChan == nil { - panic("RPC Client: the client must be started before stopping it") + logging.Logger().Warn("RPC Client: the client must be started before stopping it") + return } c.ch.Destroy(c.ctx) diff --git a/servlet.go b/servlet.go index cf2ad14..99a9482 100644 --- a/servlet.go +++ b/servlet.go @@ -104,7 +104,8 @@ func (s *rpcServlet) Context() ServletContext { func (s *rpcServlet) destroy(err error) { 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)