Przeglądaj źródła

Improve documentation about errors

Gary Burd 9 lat temu
rodzic
commit
f8c71fc158
2 zmienionych plików z 10 dodań i 4 usunięć
  1. 9 0
      redis/doc.go
  2. 1 4
      redis/redis.go

+ 9 - 0
redis/doc.go

@@ -165,4 +165,13 @@
 //   if _, err := redis.Scan(reply, &value1, &value2); err != nil {
 //      // handle error
 //  }
+//
+// Errors
+//
+// Connection methods return error replies from the server as type redis.Error.
+//
+// Call the connection Err() method to determine if the connection encountered
+// non-recoverable error such as a network error or protocol parsing error. If
+// Err() returns a non-nil value, then the connection is not usable and should
+// be closed.
 package redis // import "github.com/garyburd/redigo/redis"

+ 1 - 4
redis/redis.go

@@ -24,10 +24,7 @@ type Conn interface {
 	// Close closes the connection.
 	Close() error
 
-	// Err returns a non-nil value if the connection is broken. The returned
-	// value is either the first non-nil value returned from the underlying
-	// network connection or a protocol parsing error. Applications should
-	// close broken connections.
+	// Err returns a non-nil value when the connection is not usable.
 	Err() error
 
 	// Do sends a command to the server and returns the received reply.