1 /* vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
5 * Copyright (C) 2011 Data Differential, http://datadifferential.com/
6 * Copyright (C) 2006-2009 Brian Aker All rights reserved.
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions are
12 * * Redistributions of source code must retain the above copyright
13 * notice, this list of conditions and the following disclaimer.
15 * * Redistributions in binary form must reproduce the above
16 * copyright notice, this list of conditions and the following disclaimer
17 * in the documentation and/or other materials provided with the
20 * * The names of its contributors may not be used to endorse or
21 * promote products derived from this software without specific prior
24 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
25 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
26 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
27 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
28 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
29 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
30 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
31 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
32 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
33 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
34 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
38 #include <libmemcached/common.h>
40 const char *memcached_strerror(const memcached_st
*, memcached_return_t rc
)
44 case MEMCACHED_SUCCESS
:
47 case MEMCACHED_FAILURE
:
50 case MEMCACHED_HOST_LOOKUP_FAILURE
: // getaddrinfo only
51 return "getaddrinfo() or getnameinfo() HOSTNAME LOOKUP FAILURE";
53 case MEMCACHED_CONNECTION_FAILURE
:
54 return "CONNECTION FAILURE";
56 case MEMCACHED_CONNECTION_BIND_FAILURE
: // DEPRECATED, see MEMCACHED_HOST_LOOKUP_FAILURE
57 return "CONNECTION BIND FAILURE";
59 case MEMCACHED_READ_FAILURE
:
60 return "READ FAILURE";
62 case MEMCACHED_UNKNOWN_READ_FAILURE
:
63 return "UNKNOWN READ FAILURE";
65 case MEMCACHED_PROTOCOL_ERROR
:
66 return "PROTOCOL ERROR";
68 case MEMCACHED_CLIENT_ERROR
:
69 return "CLIENT ERROR";
71 case MEMCACHED_SERVER_ERROR
:
72 return "SERVER ERROR";
74 case MEMCACHED_WRITE_FAILURE
:
75 return "WRITE FAILURE";
78 return "ERROR was returned by server";
80 case MEMCACHED_DATA_EXISTS
:
81 return "CONNECTION DATA EXISTS";
83 case MEMCACHED_DATA_DOES_NOT_EXIST
:
84 return "CONNECTION DATA DOES NOT EXIST";
86 case MEMCACHED_NOTSTORED
:
89 case MEMCACHED_STORED
:
92 case MEMCACHED_NOTFOUND
:
95 case MEMCACHED_MEMORY_ALLOCATION_FAILURE
:
96 return "MEMORY ALLOCATION FAILURE";
98 case MEMCACHED_PARTIAL_READ
:
99 return "PARTIAL READ";
101 case MEMCACHED_SOME_ERRORS
:
102 return "SOME ERRORS WERE REPORTED";
104 case MEMCACHED_NO_SERVERS
:
105 return "NO SERVERS DEFINED";
110 case MEMCACHED_DELETED
:
111 return "SERVER DELETE";
113 case MEMCACHED_VALUE
:
114 return "SERVER VALUE";
122 case MEMCACHED_ERRNO
:
123 return "SYSTEM ERROR";
125 case MEMCACHED_FAIL_UNIX_SOCKET
:
126 return "COULD NOT OPEN UNIX SOCKET";
128 case MEMCACHED_NOT_SUPPORTED
:
129 return "ACTION NOT SUPPORTED";
131 case MEMCACHED_FETCH_NOTFINISHED
:
132 return "FETCH WAS NOT COMPLETED";
134 case MEMCACHED_NO_KEY_PROVIDED
:
135 return "A KEY LENGTH OF ZERO WAS PROVIDED";
137 case MEMCACHED_BUFFERED
:
138 return "ACTION QUEUED";
140 case MEMCACHED_TIMEOUT
:
141 return "A TIMEOUT OCCURRED";
143 case MEMCACHED_BAD_KEY_PROVIDED
:
144 return "A BAD KEY WAS PROVIDED/CHARACTERS OUT OF RANGE";
146 case MEMCACHED_INVALID_HOST_PROTOCOL
:
147 return "THE HOST TRANSPORT PROTOCOL DOES NOT MATCH THAT OF THE CLIENT";
149 case MEMCACHED_SERVER_MARKED_DEAD
:
150 return "SERVER IS MARKED DEAD";
152 case MEMCACHED_UNKNOWN_STAT_KEY
:
153 return "ENCOUNTERED AN UNKNOWN STAT KEY";
155 case MEMCACHED_E2BIG
:
156 return "ITEM TOO BIG";
158 case MEMCACHED_INVALID_ARGUMENTS
:
159 return "INVALID ARGUMENTS";
161 case MEMCACHED_KEY_TOO_BIG
:
162 return "KEY RETURNED FROM SERVER WAS TOO LARGE";
164 case MEMCACHED_AUTH_PROBLEM
:
165 return "FAILED TO SEND AUTHENTICATION TO SERVER";
167 case MEMCACHED_AUTH_FAILURE
:
168 return "AUTHENTICATION FAILURE";
170 case MEMCACHED_AUTH_CONTINUE
:
171 return "CONTINUE AUTHENTICATION";
173 case MEMCACHED_PARSE_ERROR
:
174 return "ERROR OCCURED WHILE PARSING";
176 case MEMCACHED_PARSE_USER_ERROR
:
177 return "USER INITIATED ERROR OCCURED WHILE PARSING";
179 case MEMCACHED_DEPRECATED
:
182 case MEMCACHED_IN_PROGRESS
:
183 return "OPERATION IN PROCESS";
185 case MEMCACHED_SERVER_TEMPORARILY_DISABLED
:
186 return "SERVER HAS FAILED AND IS DISABLED UNTIL TIMED RETRY";
188 case MEMCACHED_SERVER_MEMORY_ALLOCATION_FAILURE
:
189 return "SERVER FAILED TO ALLOCATE OBJECT";
192 case MEMCACHED_MAXIMUM_RETURN
:
193 return "INVALID memcached_return_t";