mirror of
https://github.com/JS8Call-improved/JS8Call-improved
synced 2026-08-13 17:47:36 -04:00
Introduce MessageError namespace
This commit is contained in:
parent
2f8a4f7c1e
commit
c1fe8a431d
4 changed files with 105 additions and 8 deletions
51
MessageError.cpp
Normal file
51
MessageError.cpp
Normal file
|
|
@ -0,0 +1,51 @@
|
|||
#include "MessageError.hpp"
|
||||
|
||||
/******************************************************************************/
|
||||
// Private Implementation
|
||||
/******************************************************************************/
|
||||
|
||||
#pragma mark 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;
|
||||
}
|
||||
|
||||
/******************************************************************************/
|
||||
// Private Implementation
|
||||
/******************************************************************************/
|
||||
|
||||
#pragma mark - Implementation
|
||||
|
||||
namespace MessageError
|
||||
{
|
||||
std::error_category const &
|
||||
category() noexcept
|
||||
{
|
||||
return Category;
|
||||
}
|
||||
}
|
||||
|
||||
/******************************************************************************/
|
||||
Loading…
Add table
Add a link
Reference in a new issue