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
|
#include "MessageError.h"
/******************************************************************************/
// Private Implementation
/******************************************************************************/
namespace {
const struct final : public std::error_category {
const char *name() const noexcept override { return "message"; }
std::string message(int const ev) const override {
using MessageError::Code;
switch (static_cast<Code>(ev)) {
case Code::json_parsing_error:
return "json parsing error";
case Code::json_not_an_object:
return "json not an object";
default:
return "message error";
}
}
} Category;
} // namespace
/******************************************************************************/
// Implementation
/******************************************************************************/
namespace MessageError {
std::error_category const &category() noexcept { return Category; }
} // namespace MessageError
/******************************************************************************/
|