JS8Call-Improved master
Loading...
Searching...
No Matches
MessageError.h
1#ifndef MESSAGE_ERROR_HPP__
2#define MESSAGE_ERROR_HPP__
3
4#include <system_error>
5
6namespace MessageError {
7enum class Code { json_parsing_error = -1001, json_not_an_object = -1002 };
8
9std::error_category const &category() noexcept;
10} // namespace MessageError
11
12namespace std {
13template <> struct is_error_code_enum<MessageError::Code> : public true_type {};
14
15template <>
16struct is_error_condition_enum<MessageError::Code> : public true_type {};
17} // namespace std
18
19namespace MessageError {
20inline std::error_code make_error_code(Code const e) noexcept {
21 return {static_cast<int>(e), category()};
22}
23
24inline std::error_condition make_error_condition(Code const e) noexcept {
25 return {static_cast<int>(e), category()};
26}
27} // namespace MessageError
28
29#endif