strerror.cc 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154
  1. /* vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
  2. *
  3. * Gearmand client and server library.
  4. *
  5. * Copyright (C) 2010-2012 Data Differential, http://datadifferential.com/
  6. * All rights reserved.
  7. *
  8. * Redistribution and use in source and binary forms, with or without
  9. * modification, are permitted provided that the following conditions are
  10. * met:
  11. *
  12. * * Redistributions of source code must retain the above copyright
  13. * notice, this list of conditions and the following disclaimer.
  14. *
  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
  18. * distribution.
  19. *
  20. * * The names of its contributors may not be used to endorse or
  21. * promote products derived from this software without specific prior
  22. * written permission.
  23. *
  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.
  35. *
  36. */
  37. /**
  38. * @file
  39. * @brief gearman_strerror()
  40. */
  41. #include "gear_config.h"
  42. #include <libgearman-server/error/strerror.h>
  43. const char *gearmand_strerror(gearmand_error_t rc)
  44. {
  45. switch (rc)
  46. {
  47. case GEARMAND_SUCCESS:
  48. return "SUCCESS";
  49. case GEARMAND_IO_WAIT:
  50. return "IO_WAIT";
  51. case GEARMAND_SHUTDOWN:
  52. return "SHUTDOWN";
  53. case GEARMAND_SHUTDOWN_GRACEFUL:
  54. return "SHUTDOWN_GRACEFUL";
  55. case GEARMAND_ERRNO:
  56. return "ERRNO";
  57. case GEARMAND_EVENT:
  58. return "EVENT";
  59. case GEARMAND_TOO_MANY_ARGS:
  60. return "TOO_MANY_ARGS";
  61. case GEARMAND_NO_ACTIVE_FDS:
  62. return "NO_ACTIVE_FDS";
  63. case GEARMAND_INVALID_MAGIC:
  64. return "INVALID_MAGIC";
  65. case GEARMAND_INVALID_COMMAND:
  66. return "INVALID_COMMAND";
  67. case GEARMAND_INVALID_PACKET:
  68. return "INVALID_PACKET";
  69. case GEARMAND_UNEXPECTED_PACKET:
  70. return "UNEXPECTED_PACKET";
  71. case GEARMAND_GETADDRINFO:
  72. return "GETADDRINFO";
  73. case GEARMAND_NO_SERVERS:
  74. return "NO_SERVERS";
  75. case GEARMAND_LOST_CONNECTION:
  76. return "LOST_CONNECTION";
  77. case GEARMAND_MEMORY_ALLOCATION_FAILURE:
  78. return "MEMORY_ALLOCATION_FAILURE";
  79. case GEARMAND_JOB_EXISTS:
  80. return "JOB_EXISTS";
  81. case GEARMAND_JOB_QUEUE_FULL:
  82. return "JOB_JOB_QUEUE_FULL";
  83. case GEARMAND_SERVER_ERROR:
  84. return "SERVER_ERROR";
  85. case GEARMAND_WORK_ERROR:
  86. return "WORK_ERROR";
  87. case GEARMAND_WORK_DATA:
  88. return "WORK_DATA";
  89. case GEARMAND_WORK_WARNING:
  90. return "WORK_WARNING";
  91. case GEARMAND_WORK_STATUS:
  92. return "WORK_STATUS";
  93. case GEARMAND_WORK_EXCEPTION:
  94. return "WORK_EXCEPTION";
  95. case GEARMAND_WORK_FAIL:
  96. return "WORK_FAIL";
  97. case GEARMAND_NOT_CONNECTED:
  98. return "NOT_CONNECTED";
  99. case GEARMAND_COULD_NOT_CONNECT:
  100. return "COULD_NOT_CONNECT";
  101. case GEARMAND_SEND_IN_PROGRESS:
  102. return "SEND_IN_PROGRESS";
  103. case GEARMAND_RECV_IN_PROGRESS:
  104. return "RECV_IN_PROGRESS";
  105. case GEARMAND_NOT_FLUSHING:
  106. return "NOT_FLUSHING";
  107. case GEARMAND_DATA_TOO_LARGE:
  108. return "DATA_TOO_LARGE";
  109. case GEARMAND_INVALID_FUNCTION_NAME:
  110. return "INVALID_FUNCTION_NAME";
  111. case GEARMAND_INVALID_WORKER_FUNCTION:
  112. return "INVALID_WORKER_FUNCTION";
  113. case GEARMAND_NO_REGISTERED_FUNCTION:
  114. return "NO_REGISTERED_FUNCTION";
  115. case GEARMAND_NO_REGISTERED_FUNCTIONS:
  116. return "NO_REGISTERED_FUNCTIONS";
  117. case GEARMAND_NO_JOBS:
  118. return "NO_JOBS";
  119. case GEARMAND_ECHO_DATA_CORRUPTION:
  120. return "ECHO_DATA_CORRUPTION";
  121. case GEARMAND_NEED_WORKLOAD_FN:
  122. return "NEED_WORKLOAD_FN";
  123. case GEARMAND_PAUSE:
  124. return "PAUSE";
  125. case GEARMAND_UNKNOWN_STATE:
  126. return "UNKNOWN_STATE";
  127. case GEARMAND_PTHREAD:
  128. return "PTHREAD";
  129. case GEARMAND_PIPE_EOF:
  130. return "PIPE_EOF";
  131. case GEARMAND_QUEUE_ERROR:
  132. return "QUEUE_ERROR";
  133. case GEARMAND_FLUSH_DATA:
  134. return "FLUSH_DATA";
  135. case GEARMAND_SEND_BUFFER_TOO_SMALL:
  136. return "SEND_BUFFER_TOO_SMALL";
  137. case GEARMAND_IGNORE_PACKET:
  138. return "IGNORE_PACKET";
  139. case GEARMAND_UNKNOWN_OPTION:
  140. return "UNKNOWN_OPTION";
  141. case GEARMAND_TIMEOUT:
  142. return "TIMEOUT";
  143. case GEARMAND_ARGUMENT_TOO_LARGE:
  144. return "The argument was too large for Gearman to handle.";
  145. case GEARMAND_INVALID_ARGUMENT:
  146. return "An invalid argument was passed to a function.";
  147. case GEARMAND_MAX_RETURN:
  148. default:
  149. return "Gibberish returned!";
  150. }
  151. }