strerror.c 959 B

12345678910111213141516171819202122232425262728293031323334
  1. // (C) 2013-2015 Cybozu.
  2. #include "yrmcds.h"
  3. const char* yrmcds_strerror(yrmcds_error e) {
  4. switch( e ) {
  5. case YRMCDS_OK:
  6. return "OK";
  7. case YRMCDS_SYSTEM_ERROR:
  8. return "Check errno for details";
  9. case YRMCDS_BAD_ARGUMENT:
  10. return "Bad argument";
  11. case YRMCDS_NOT_RESOLVED:
  12. return "Host not found";
  13. case YRMCDS_TIMEOUT:
  14. return "Timeout";
  15. case YRMCDS_DISCONNECTED:
  16. return "Connection was reset by peer";
  17. case YRMCDS_OUT_OF_MEMORY:
  18. return "Failed to allocate memory";
  19. case YRMCDS_COMPRESS_FAILED:
  20. return "Failed to compress data";
  21. case YRMCDS_PROTOCOL_ERROR:
  22. return "Received malformed packet";
  23. case YRMCDS_NOT_IMPLEMENTED:
  24. return "Not implemented";
  25. case YRMCDS_IN_BINARY:
  26. return "Connection is fixed for binary protocol";
  27. case YRMCDS_BAD_KEY:
  28. return "Bad key";
  29. default:
  30. return "Unknown error";
  31. };
  32. }