forked from JS8Call-improved/JS8Call-improved
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMessageError.hpp
More file actions
41 lines (33 loc) · 777 Bytes
/
MessageError.hpp
File metadata and controls
41 lines (33 loc) · 777 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#ifndef MESSAGE_ERROR_HPP__
#define MESSAGE_ERROR_HPP__
#include <system_error>
namespace MessageError
{
enum class Code
{
json_parsing_error = -1001,
json_not_an_object = -1002
};
std::error_category const & category() noexcept;
}
namespace std
{
template<>
struct is_error_code_enum<MessageError::Code> : public true_type{};
template<>
struct is_error_condition_enum<MessageError::Code> : public true_type{};
}
namespace MessageError
{
inline std::error_code
make_error_code(Code const e) noexcept
{
return {static_cast<int>(e), category()};
}
inline std::error_condition
make_error_condition(Code const e) noexcept
{
return {static_cast<int>(e), category()};
}
}
#endif