A tool for adding anime to your anidb list.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

77 lines
2.9KB

  1. #ifndef _ERROR_H
  2. #define _ERROR_H
  3. #define FE_ERROR(E) \
  4. E(NOERR = 0) \
  5. E(ERR_UNKNOWN) \
  6. E(ERR_NOTFOUND) \
  7. \
  8. E(ERR_OPT_REQUIRED) \
  9. E(ERR_OPT_FAILED) \
  10. E(ERR_OPT_UNHANDLED) \
  11. E(ERR_OPT_INVVAL) \
  12. E(ERR_OPT_EXIT) /* We should exit in main, if config_parse returns this */ \
  13. E(ERR_OPT_UNSET) /* In config_get, if the value isn't set */ \
  14. E(ERR_OPT_NOTFOUND) /* In config_get, if the options is not found */ \
  15. E(ERR_OPT_NO_SUBCOMMAND) \
  16. \
  17. E(ERR_NET_APIADDR) /* If there are problems with the api servers address */ \
  18. E(ERR_NET_SOCKET) /* If there are problems with the udp socket */ \
  19. E(ERR_NET_CONNECTED) /* Socket already connected */ \
  20. E(ERR_NET_CONNECT_FAIL) /* Connect attempt failed */ \
  21. E(ERR_NET_NOT_CONNECTED) /* Socket wasn't connected */ \
  22. \
  23. E(ERR_CMD_FAILED) /* Running the command failed */ \
  24. E(ERR_CMD_NONE) /* No command was run */ \
  25. E(ERR_CMD_ARG) /* Some problem with the command arguments */ \
  26. \
  27. E(ERR_ED2KUTIL_FS) /* Some filesystem problem */ \
  28. E(ERR_ED2KUTIL_UNSUP) /* Operation or file type is unsupported */ \
  29. E(ED2KUTIL_DONTHASH) /* Skip the hashing part. pre_hash_fn can return this */ \
  30. \
  31. E(ERR_API_ENCRYPTFAIL) /* Cannot start encryption with the api */ \
  32. E(ERR_API_COMMFAIL) /* Communication failure */ \
  33. E(ERR_API_RESP_INVALID) /* Invalid response */ \
  34. E(ERR_API_AUTH_FAIL) /* Auth failed */ \
  35. E(ERR_API_LOGOUT) /* Logout failed */ \
  36. E(ERR_API_PRINTFFUNC) /* New printf function registration failed */ \
  37. E(ERR_API_CLOCK) /* Some error with clocks */ \
  38. E(ERR_API_INVCOMM) /* Invalid command or command arguments */ \
  39. E(ERR_API_BANNED) /* Got banned */ \
  40. E(ERR_API_CMD_UNK) /* Unknown command */ \
  41. E(ERR_API_INT_SRV) /* Internal server error */ \
  42. E(ERR_API_OOS) /* AniDB is out of service rn */ \
  43. E(ERR_API_SRV_BUSY) /* Server is too busy, try again later */ \
  44. E(ERR_API_TIMEOUT) /* Timed out, delay and resubmit */ \
  45. E(ERR_API_NOLOGIN) /* Login is required for this command */ \
  46. E(ERR_API_AXX_DENIED) /* Access is denied */ \
  47. E(ERR_API_INV_SESSION) /* Session is invalid */ \
  48. \
  49. E(ERR_CACHE_SQLITE) /* Generic sqlite error code */ \
  50. E(ERR_CACHE_EXISTS) /* Entry already exists, as determined by lid */ \
  51. /* The entry to be added is not unique, (filename and size duplicate, not hash or lid) */ \
  52. E(ERR_CACHE_NON_UNIQUE) \
  53. E(ERR_CACHE_NO_EXISTS) /* Entry does not exists */ \
  54. \
  55. E(ERR_THRD) /* Generic pthread error */ \
  56. \
  57. E(ERR_LIBEVENT) /* There are some problem with a libevent function */ \
  58. \
  59. E(ERR_SHOULD_EXIT) /* Probably got a C-c, program should exit now */ \
  60. E(_ERR_COUNT) \
  61. #define GEN_ENUM(ENUM) ENUM,
  62. #define GEN_STRING(STRING) #STRING,
  63. enum error {
  64. FE_ERROR(GEN_ENUM)
  65. };
  66. /*
  67. * Convert a number (0) to the enum name (NOERR)
  68. */
  69. const char *error_to_string(enum error err);
  70. #endif /* _ERROR_H */