tjons commented on code in PR #1889:
URL: 
https://github.com/apache/cassandra-gocql-driver/pull/1889#discussion_r2116603403


##########
session.go:
##########
@@ -454,6 +454,10 @@ func (s *Session) Bind(stmt string, b func(q *QueryInfo) 
([]interface{}, error))
 // Close closes all connections. The session is unusable after this
 // operation.
 func (s *Session) Close() {
+       // Closing a nil session is a non-event, return.
+       if s == nil {

Review Comment:
   Yep! https://go.dev/doc/effective_go#errors
   
   > But what if the error is unrecoverable? Sometimes the program simply 
cannot continue.
   > 
   > For this purpose, there is a built-in function panic that in effect 
creates a run-time error that will stop the program (but see the next section). 
The function takes a single argument of arbitrary type—often a string—to be 
printed as the program dies. It's also a way to indicate that something 
impossible has happened, such as exiting an infinite loop.
   
   And later: 
   > This is only an example but real library functions should avoid panic. If 
the problem can be masked or worked around, it's always better to let things 
continue to run rather than taking down the whole program. One possible 
counterexample is during initialization: if the library truly cannot set itself 
up, it might be reasonable to panic, so to speak.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: pr-unsubscr...@cassandra.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: pr-unsubscr...@cassandra.apache.org
For additional commands, e-mail: pr-h...@cassandra.apache.org

Reply via email to