strerror.cc 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  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/common.h>
  43. // Please see http://gearman.info/libgearman/gearman_return_t.html
  44. const char *gearman_strerror(gearman_return_t rc)
  45. {
  46. switch (rc)
  47. {
  48. case GEARMAN_SUCCESS: return "GEARMAN_SUCCESS";
  49. case GEARMAN_ARGUMENT_TOO_LARGE: return "GEARMAN_ARGUMENT_TOO_LARGE";
  50. case GEARMAN_COULD_NOT_CONNECT: return "GEARMAN_COULD_NOT_CONNECT";
  51. case GEARMAN_DATA_TOO_LARGE: return "GEARMAN_DATA_TOO_LARGE";
  52. case GEARMAN_ECHO_DATA_CORRUPTION: return "GEARMAN_ECHO_DATA_CORRUPTION";
  53. case GEARMAN_ERRNO: return "GEARMAN_ERRNO";
  54. case GEARMAN_EVENT: return "GEARMAN_EVENT";
  55. case GEARMAN_FLUSH_DATA: return "GEARMAN_FLUSH_DATA";
  56. case GEARMAN_GETADDRINFO: return "GEARMAN_GETADDRINFO";
  57. case GEARMAN_IGNORE_PACKET: return "GEARMAN_IGNORE_PACKET";
  58. case GEARMAN_INVALID_ARGUMENT: return "GEARMAN_INVALID_ARGUMENT";
  59. case GEARMAN_INVALID_COMMAND: return "GEARMAN_INVALID_COMMAND";
  60. case GEARMAN_INVALID_FUNCTION_NAME: return "GEARMAN_INVALID_FUNCTION_NAME";
  61. case GEARMAN_INVALID_MAGIC: return "GEARMAN_INVALID_MAGIC";
  62. case GEARMAN_INVALID_PACKET: return "GEARMAN_INVALID_PACKET";
  63. case GEARMAN_INVALID_WORKER_FUNCTION: return "GEARMAN_INVALID_WORKER_FUNCTION";
  64. case GEARMAN_IN_PROGRESS: return "GEARMAN_IN_PROGRESS";
  65. case GEARMAN_IO_WAIT: return "GEARMAN_IO_WAIT";
  66. case GEARMAN_JOB_EXISTS: return "GEARMAN_JOB_EXISTS";
  67. case GEARMAN_JOB_QUEUE_FULL: return "GEARMAN_JOB_QUEUE_FULL";
  68. case GEARMAN_LOST_CONNECTION: return "GEARMAN_LOST_CONNECTION";
  69. case GEARMAN_MEMORY_ALLOCATION_FAILURE: return "GEARMAN_MEMORY_ALLOCATION_FAILURE";
  70. case GEARMAN_NEED_WORKLOAD_FN: return "GEARMAN_NEED_WORKLOAD_FN";
  71. case GEARMAN_NOT_CONNECTED: return "GEARMAN_NOT_CONNECTED";
  72. case GEARMAN_NOT_FLUSHING: return "GEARMAN_NOT_FLUSHING";
  73. case GEARMAN_NO_ACTIVE_FDS: return "GEARMAN_NO_ACTIVE_FDS";
  74. case GEARMAN_NO_JOBS: return "GEARMAN_NO_JOBS";
  75. case GEARMAN_NO_REGISTERED_FUNCTION: return "GEARMAN_NO_REGISTERED_FUNCTION";
  76. case GEARMAN_NO_REGISTERED_FUNCTIONS: return "GEARMAN_NO_REGISTERED_FUNCTIONS";
  77. case GEARMAN_NO_SERVERS: return "GEARMAN_NO_SERVERS";
  78. case GEARMAN_PAUSE: return "GEARMAN_PAUSE";
  79. case GEARMAN_PIPE_EOF: return "GEARMAN_PIPE_EOF";
  80. case GEARMAN_PTHREAD: return "GEARMAN_PTHREAD";
  81. case GEARMAN_QUEUE_ERROR: return "GEARMAN_QUEUE_ERROR";
  82. case GEARMAN_RECV_IN_PROGRESS: return "GEARMAN_RECV_IN_PROGRESS";
  83. case GEARMAN_SEND_BUFFER_TOO_SMALL: return "GEARMAN_SEND_BUFFER_TOO_SMALL";
  84. case GEARMAN_SEND_IN_PROGRESS: return "GEARMAN_SEND_IN_PROGRESS";
  85. case GEARMAN_SERVER_ERROR: return "GEARMAN_SERVER_ERROR";
  86. case GEARMAN_SHUTDOWN: return "GEARMAN_SHUTDOWN";
  87. case GEARMAN_SHUTDOWN_GRACEFUL: return "GEARMAN_SHUTDOWN_GRACEFUL";
  88. case GEARMAN_TIMEOUT: return "GEARMAN_TIMEOUT";
  89. case GEARMAN_TOO_MANY_ARGS: return "GEARMAN_TOO_MANY_ARGS";
  90. case GEARMAN_UNEXPECTED_PACKET: return "GEARMAN_UNEXPECTED_PACKET";
  91. case GEARMAN_UNKNOWN_OPTION: return "GEARMAN_UNKNOWN_OPTION";
  92. case GEARMAN_UNKNOWN_STATE: return "GEARMAN_UNKNOWN_STATE";
  93. case GEARMAN_WORK_DATA: return "GEARMAN_WORK_DATA";
  94. case GEARMAN_WORK_ERROR: return "GEARMAN_WORK_ERROR";
  95. case GEARMAN_WORK_EXCEPTION: return "GEARMAN_WORK_EXCEPTION";
  96. case GEARMAN_WORK_FAIL: return "GEARMAN_WORK_FAIL";
  97. case GEARMAN_WORK_STATUS: return "GEARMAN_WORK_STATUS";
  98. case GEARMAN_WORK_WARNING: return "GEARMAN_WORK_WARNING";
  99. case GEARMAN_INVALID_SERVER_OPTION: return "GEARMAN_INVALID_SERVER_OPTION";
  100. case GEARMAN_JOB_NOT_FOUND: return "GEARMAN_JOB_NOT_FOUND";
  101. case GEARMAN_MAX_RETURN:
  102. default:
  103. return "GEARMAN_MAX_RETURN";
  104. }
  105. }