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.

66 lines
2.3KB

  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. \
  16. E(ERR_NET_APIADDR) /* If there are problems with the api servers address */ \
  17. E(ERR_NET_SOCKET) /* If there are problems with the udp socket */ \
  18. E(ERR_NET_CONNECTED) /* Socket already connected */ \
  19. E(ERR_NET_CONNECT_FAIL) /* Connect attempt failed */ \
  20. E(ERR_NET_NOT_CONNECTED) /* Socket wasn't connected */ \
  21. \
  22. E(ERR_CMD_FAILED) /* Running the command failed */ \
  23. E(ERR_CMD_NONE) /* No command was run */ \
  24. E(ERR_CMD_ARG) /* Some problem with the command arguments */ \
  25. \
  26. E(ERR_ED2KUTIL_FS) /* Some filesystem problem */ \
  27. E(ERR_ED2KUTIL_UNSUP) /* Operation or file type is unsupported */ \
  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. \
  38. E(ERR_CACHE_SQLITE) /* Generic sqlite error code */ \
  39. E(ERR_CACHE_EXISTS) /* Entry already exists, as determined by lid */ \
  40. /* The entry to be added is not unique, (filename and size duplicate, not hash or lid) */ \
  41. E(ERR_CACHE_NON_UNIQUE) \
  42. E(ERR_CACHE_NO_EXISTS) /* Entry does not exists */ \
  43. \
  44. E(ERR_THRD) /* Generic pthread error */ \
  45. \
  46. E(ERR_LIBEVENT) /* There are some problem with a libevent function */ \
  47. \
  48. E(ERR_SHOULD_EXIT) /* Probably got a C-c, program should exit now */ \
  49. E(_ERR_COUNT) \
  50. #define GEN_ENUM(ENUM) ENUM,
  51. #define GEN_STRING(STRING) #STRING,
  52. enum error {
  53. FE_ERROR(GEN_ENUM)
  54. };
  55. /*
  56. * Convert a number (0) to the enum name (NOERR)
  57. */
  58. const char *error_to_string(enum error err);
  59. #endif /* _ERROR_H */