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.

76 lines
2.8KB

  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_ITERPATH) /* Couldn't start iterating over the given path */ \
  28. E(ED2KUTIL_DONTHASH) /* Skip the hashing part. pre_hash_fn can return this */ \
  29. \
  30. E(ERR_API_ENCRYPTFAIL) /* Cannot start encryption with the api */ \
  31. E(ERR_API_COMMFAIL) /* Communication failure */ \
  32. E(ERR_API_RESP_INVALID) /* Invalid response */ \
  33. E(ERR_API_AUTH_FAIL) /* Auth failed */ \
  34. E(ERR_API_LOGOUT) /* Logout failed */ \
  35. E(ERR_API_PRINTFFUNC) /* New printf function registration failed */ \
  36. E(ERR_API_CLOCK) /* Some error with clocks */ \
  37. E(ERR_API_INVCOMM) /* Invalid command or command arguments */ \
  38. E(ERR_API_BANNED) /* Got banned */ \
  39. E(ERR_API_CMD_UNK) /* Unknown command */ \
  40. E(ERR_API_INT_SRV) /* Internal server error */ \
  41. E(ERR_API_OOS) /* AniDB is out of service rn */ \
  42. E(ERR_API_SRV_BUSY) /* Server is too busy, try again later */ \
  43. E(ERR_API_TIMEOUT) /* Timed out, delay and resubmit */ \
  44. E(ERR_API_NOLOGIN) /* Login is required for this command */ \
  45. E(ERR_API_AXX_DENIED) /* Access is denied */ \
  46. E(ERR_API_INV_SESSION) /* Session is invalid */ \
  47. \
  48. E(ERR_CACHE_SQLITE) /* Generic sqlite error code */ \
  49. E(ERR_CACHE_EXISTS) /* Entry already exists, as determined by lid */ \
  50. /* The entry to be added is not unique, (filename and size duplicate, not hash or lid) */ \
  51. E(ERR_CACHE_NON_UNIQUE) \
  52. E(ERR_CACHE_NO_EXISTS) /* Entry does not exists */ \
  53. \
  54. E(ERR_THRD) /* Generic pthread error */ \
  55. \
  56. E(ERR_LIBEVENT) /* There are some problem with a libevent function */ \
  57. \
  58. E(ERR_SHOULD_EXIT) /* Probably got a C-c, program should exit now */ \
  59. E(_ERR_COUNT) \
  60. #define GEN_ENUM(ENUM) ENUM,
  61. #define GEN_STRING(STRING) #STRING,
  62. enum error {
  63. FE_ERROR(GEN_ENUM)
  64. };
  65. /*
  66. * Convert a number (0) to the enum name (NOERR)
  67. */
  68. const char *error_to_string(enum error err);
  69. #endif /* _ERROR_H */