mirror of
https://github.com/JS8Call-improved/JS8Call-improved
synced 2026-08-13 17:47:36 -04:00
40 lines
1.2 KiB
C++
40 lines
1.2 KiB
C++
/**
|
|
* @file MessageError.cpp
|
|
* @brief Implementation of the message error for external servers/clients
|
|
*/
|
|
|
|
#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
|
|
|
|
/******************************************************************************/
|