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.2 KiB

  1. #pragma once
  2. #include <string>
  3. #include <cppcore/misc/exception.h>
  4. namespace cpprtti
  5. {
  6. enum class error_code
  7. {
  8. unknown = -1,
  9. none = 0,
  10. /* registry */
  11. registry_error = 1000,
  12. registry_type_not_found, //!< Unable to find the requested type.
  13. registry_id_already_exsists, //!< Unable to create type: The type ID does already exist!
  14. registry_name_already_exsists, //!< Unable to create type: The type name does already exist!
  15. registry_type_does_not_match, //!< Unable to get type: The implementation of the type does not match!
  16. /* variant */
  17. variant_error = 2000,
  18. variant_is_empty, //!< The variant does not store any value!
  19. variant_type_mismatch, //!< The variant does not store the requested type!
  20. variant_invalid_cast, //!< The value stored in the variant could not be cast to the requested type!
  21. /* class */
  22. class_error = 3000,
  23. class_member_already_exists, //!< Unable to create member: Name is already in use!
  24. class_type_mismatch, //!< Type does not match the.
  25. class_member_not_readable, //!< Member variable is not readable!
  26. class_member_not_writable, //!< Member variable is not writable!
  27. };
  28. /**
  29. * @brief Get the string representation of the passed error code.
  30. */
  31. inline std::string get_error_code_str(error_code err);
  32. /**
  33. * @brief Exception to represent curl errors.
  34. */
  35. struct exception
  36. : public ::cppcore::exception
  37. {
  38. public:
  39. error_code error;
  40. const std::string detail;
  41. /**
  42. * @brief Constructor.
  43. */
  44. inline exception(
  45. error_code p_error);
  46. /**
  47. * @brief Constructor.
  48. */
  49. inline exception(
  50. error_code p_error,
  51. const std::string& p_detail);
  52. protected:
  53. /**
  54. * @brief Print the message of the exception to the passed stream.
  55. *
  56. * @param[in] os Stream to print message of the exception to.
  57. */
  58. inline void print_message(std::ostream& os) const override;
  59. };
  60. }
  61. #include "exception.inl"