|
- #pragma once
-
- #include <string>
-
- #include <cppcore/misc/exception.h>
-
- namespace cpprtti
- {
-
- enum class error_code
- {
- unknown = -1,
-
- none = 0,
-
- /* registry */
- registry_error = 1000,
- registry_type_not_found, //!< Unable to find the requested type.
- registry_id_already_exsists, //!< Unable to create type: The type ID does already exist!
- registry_name_already_exsists, //!< Unable to create type: The type name does already exist!
- registry_type_does_not_match, //!< Unable to get type: The implementation of the type does not match!
-
- /* variant */
- variant_error = 2000,
- variant_is_empty, //!< The variant does not store any value!
- variant_type_mismatch, //!< The variant does not store the requested type!
- variant_invalid_cast, //!< The value stored in the variant could not be cast to the requested type!
-
- /* class */
- class_error = 3000,
- class_member_already_exists, //!< Unable to create member: Name is already in use!
- class_type_mismatch, //!< Type does not match the.
- class_member_not_readable, //!< Member variable is not readable!
- class_member_not_writable, //!< Member variable is not writable!
- };
-
- /**
- * @brief Get the string representation of the passed error code.
- */
- inline std::string get_error_code_str(error_code err);
-
- /**
- * @brief Exception to represent curl errors.
- */
- struct exception
- : public ::cppcore::exception
- {
- public:
- error_code error;
- const std::string detail;
-
- /**
- * @brief Constructor.
- */
- inline exception(
- error_code p_error);
-
- /**
- * @brief Constructor.
- */
- inline exception(
- error_code p_error,
- const std::string& p_detail);
-
- protected:
- /**
- * @brief Print the message of the exception to the passed stream.
- *
- * @param[in] os Stream to print message of the exception to.
- */
- inline void print_message(std::ostream& os) const override;
- };
-
- }
-
- #include "exception.inl"
|