From: Brian Aker Date: Sat, 30 Jul 2011 18:58:49 +0000 (-0700) Subject: Expand error for incorrect report. X-Git-Tag: 0.52~37 X-Git-Url: https://git.m6w6.name/?a=commitdiff_plain;h=f814bf90a3e60b70688edfafec4a850400a8a9ac;p=m6w6%2Flibmemcached Expand error for incorrect report. --- diff --git a/libmemcached/error.cc b/libmemcached/error.cc index 5afb2282..b0bdd3f8 100644 --- a/libmemcached/error.cc +++ b/libmemcached/error.cc @@ -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; } diff --git a/libmemcached/response.cc b/libmemcached/response.cc index dddcb349..74d10a96 100644 --- a/libmemcached/response.cc +++ b/libmemcached/response.cc @@ -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: