Expand error for incorrect report.
authorBrian Aker <brian@tangent.org>
Sat, 30 Jul 2011 18:58:49 +0000 (11:58 -0700)
committerBrian Aker <brian@tangent.org>
Sat, 30 Jul 2011 18:58:49 +0000 (11:58 -0700)
libmemcached/error.cc
libmemcached/response.cc

index 5afb22824a3c0932bce7ab5e499010345973f34e..b0bdd3f85386fdb1f10032b86fd134efa5ea5593 100644 (file)
@@ -495,10 +495,15 @@ memcached_error_t *memcached_error_copy(const memcached_server_st& server)
 
 memcached_return_t memcached_server_error_return(memcached_server_instance_st ptr)
 {
+  if (ptr == NULL)
+  {
+    return MEMCACHED_INVALID_ARGUMENTS;
+  }
+
   if (ptr and ptr->error_messages)
   {
     return ptr->error_messages->rc;
   }
 
-  return MEMCACHED_FAILURE;
+  return MEMCACHED_SUCCESS;
 }
index dddcb349ca48aac4d1965afc16f6d8a64bec5e61..74d10a96a0eabf264aad4f6b3c334edbdf83e3c7 100644 (file)
@@ -613,24 +613,31 @@ static memcached_return_t binary_read_one_response(memcached_server_write_instan
     case PROTOCOL_BINARY_RESPONSE_KEY_ENOENT:
       rc= MEMCACHED_NOTFOUND;
       break;
+
     case PROTOCOL_BINARY_RESPONSE_KEY_EEXISTS:
       rc= MEMCACHED_DATA_EXISTS;
       break;
+
     case PROTOCOL_BINARY_RESPONSE_NOT_STORED:
       rc= MEMCACHED_NOTSTORED;
       break;
+
     case PROTOCOL_BINARY_RESPONSE_E2BIG:
       rc= MEMCACHED_E2BIG;
       break;
+
     case PROTOCOL_BINARY_RESPONSE_ENOMEM:
       rc= MEMCACHED_MEMORY_ALLOCATION_FAILURE;
       break;
+
     case PROTOCOL_BINARY_RESPONSE_AUTH_CONTINUE:
       rc= MEMCACHED_AUTH_CONTINUE;
       break;
+
     case PROTOCOL_BINARY_RESPONSE_AUTH_ERROR:
       rc= MEMCACHED_AUTH_FAILURE;
       break;
+
     case PROTOCOL_BINARY_RESPONSE_EINVAL:
     case PROTOCOL_BINARY_RESPONSE_UNKNOWN_COMMAND:
     default: