error.hpp 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  1. /* Copyright (c) 2018-2024 Marcelo Zimbres Silva (mzimbres@gmail.com)
  2. *
  3. * Distributed under the Boost Software License, Version 1.0. (See
  4. * accompanying file LICENSE.txt)
  5. */
  6. #ifndef BOOST_REDIS_ERROR_HPP
  7. #define BOOST_REDIS_ERROR_HPP
  8. #include <boost/system/error_code.hpp>
  9. namespace boost::redis {
  10. /// Generic errors.
  11. enum class error
  12. {
  13. /// Invalid RESP3 type.
  14. invalid_data_type = 1,
  15. /// Can't parse the string as a number.
  16. not_a_number,
  17. /// The maximum depth of a nested response was exceeded.
  18. exceeeds_max_nested_depth,
  19. /// Got non boolean value.
  20. unexpected_bool_value,
  21. /// Expected field value is empty.
  22. empty_field,
  23. /// Expects a simple RESP3 type but got an aggregate.
  24. expects_resp3_simple_type,
  25. /// Expects aggregate.
  26. expects_resp3_aggregate,
  27. /// Expects a map but got other aggregate.
  28. expects_resp3_map,
  29. /// Expects a set aggregate but got something else.
  30. expects_resp3_set,
  31. /// Nested response not supported.
  32. nested_aggregate_not_supported,
  33. /// Got RESP3 simple error.
  34. resp3_simple_error,
  35. /// Got RESP3 blob_error.
  36. resp3_blob_error,
  37. /// Aggregate container has incompatible size.
  38. incompatible_size,
  39. /// Not a double
  40. not_a_double,
  41. /// Got RESP3 null.
  42. resp3_null,
  43. /// There is no stablished connection.
  44. not_connected,
  45. /// Resolve timeout
  46. resolve_timeout,
  47. /// Connect timeout
  48. connect_timeout,
  49. /// The server didn't answer the health checks on time and didn't send any data during the health check period.
  50. pong_timeout,
  51. /// SSL handshake timeout
  52. ssl_handshake_timeout,
  53. /// Can't receive push synchronously without blocking
  54. sync_receive_push_failed,
  55. /// Incompatible node depth.
  56. incompatible_node_depth,
  57. /// The setup request sent during connection establishment failed (the name is historical).
  58. resp3_hello,
  59. /// The configuration specified a UNIX socket address, but UNIX sockets are not supported by the system.
  60. unix_sockets_unsupported,
  61. /// The configuration specified UNIX sockets with SSL, which is not supported.
  62. unix_sockets_ssl_unsupported,
  63. /// Reading data from the socket would exceed the maximum size allowed of the read buffer.
  64. exceeds_maximum_read_buffer_size,
  65. /// Timeout while writing data to the server.
  66. write_timeout,
  67. };
  68. /**
  69. * @brief Creates a error_code object from an error.
  70. *
  71. * @param e Error code.
  72. */
  73. auto make_error_code(error e) -> system::error_code;
  74. } // namespace boost::redis
  75. namespace std {
  76. template <>
  77. struct is_error_code_enum<::boost::redis::error> : std::true_type { };
  78. } // namespace std
  79. #endif // BOOST_REDIS_ERROR_HPP