error.hpp 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. /* Copyright (c) 2018-2023 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. /** \brief Generic errors.
  11. * \ingroup high-level-api
  12. */
  13. enum class error
  14. {
  15. /// Invalid RESP3 type.
  16. invalid_data_type = 1,
  17. /// Can't parse the string as a number.
  18. not_a_number,
  19. /// The maximum depth of a nested response was exceeded.
  20. exceeeds_max_nested_depth,
  21. /// Got non boolean value.
  22. unexpected_bool_value,
  23. /// Expected field value is empty.
  24. empty_field,
  25. /// Expects a simple RESP3 type but got an aggregate.
  26. expects_resp3_simple_type,
  27. /// Expects aggregate.
  28. expects_resp3_aggregate,
  29. /// Expects a map but got other aggregate.
  30. expects_resp3_map,
  31. /// Expects a set aggregate but got something else.
  32. expects_resp3_set,
  33. /// Nested response not supported.
  34. nested_aggregate_not_supported,
  35. /// Got RESP3 simple error.
  36. resp3_simple_error,
  37. /// Got RESP3 blob_error.
  38. resp3_blob_error,
  39. /// Aggregate container has incompatible size.
  40. incompatible_size,
  41. /// Not a double
  42. not_a_double,
  43. /// Got RESP3 null.
  44. resp3_null,
  45. /// There is no stablished connection.
  46. not_connected,
  47. /// Resolve timeout
  48. resolve_timeout,
  49. /// Connect timeout
  50. connect_timeout,
  51. /// Connect timeout
  52. pong_timeout,
  53. /// SSL handshake timeout
  54. ssl_handshake_timeout,
  55. /// Can't receive push synchronously without blocking
  56. sync_receive_push_failed,
  57. /// Incompatible node depth.
  58. incompatible_node_depth,
  59. };
  60. /** \internal
  61. * \brief Creates a error_code object from an error.
  62. * \param e Error code.
  63. * \ingroup any
  64. */
  65. auto make_error_code(error e) -> system::error_code;
  66. } // boost::redis
  67. namespace std {
  68. template<>
  69. struct is_error_code_enum<::boost::redis::error> : std::true_type {};
  70. } // std
  71. #endif // BOOST_REDIS_ERROR_HPP