2018-04-05 16:36:26 +00:00
|
|
|
#pragma once
|
|
|
|
#include <stdexcept>
|
|
|
|
|
|
|
|
namespace ki
|
|
|
|
{
|
|
|
|
namespace protocol
|
|
|
|
{
|
|
|
|
class runtime_error : public std::runtime_error
|
|
|
|
{
|
|
|
|
public:
|
2018-04-22 16:11:12 +00:00
|
|
|
explicit runtime_error(std::string message) : std::runtime_error(message) {}
|
2018-04-05 16:36:26 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
class parse_error : public runtime_error
|
|
|
|
{
|
|
|
|
public:
|
2018-04-22 16:11:12 +00:00
|
|
|
enum code
|
|
|
|
{
|
|
|
|
NONE,
|
|
|
|
INVALID_XML_DATA,
|
|
|
|
INVALID_HEADER_DATA,
|
|
|
|
INSUFFICIENT_MESSAGE_DATA,
|
|
|
|
INVALID_MESSAGE_DATA
|
|
|
|
};
|
|
|
|
|
|
|
|
explicit parse_error(std::string message, code error = code::NONE)
|
|
|
|
: runtime_error(message)
|
|
|
|
{
|
|
|
|
m_code = error;
|
|
|
|
}
|
|
|
|
|
|
|
|
code get_error_code() const { return m_code; }
|
|
|
|
private:
|
|
|
|
code m_code;
|
2018-04-05 16:36:26 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
class value_error : public runtime_error
|
|
|
|
{
|
|
|
|
public:
|
2018-04-22 16:11:12 +00:00
|
|
|
enum code
|
|
|
|
{
|
|
|
|
NONE,
|
|
|
|
MISSING_FILE,
|
|
|
|
OVERWRITES_LOOKUP,
|
|
|
|
EXCEEDS_LIMIT,
|
|
|
|
|
|
|
|
DML_INVALID_SERVICE,
|
|
|
|
DML_INVALID_PROTOCOL_TYPE,
|
|
|
|
DML_INVALID_MESSAGE_TYPE,
|
|
|
|
DML_INVALID_MESSAGE_NAME
|
|
|
|
};
|
|
|
|
|
|
|
|
explicit value_error(std::string message, code error = code::NONE)
|
|
|
|
: runtime_error(message)
|
|
|
|
{
|
|
|
|
m_code = error;
|
|
|
|
}
|
|
|
|
|
|
|
|
code get_error_code() const { return m_code; }
|
|
|
|
private:
|
|
|
|
code m_code;
|
2018-04-05 16:36:26 +00:00
|
|
|
};
|
|
|
|
}
|
|
|
|
}
|