query/source/core/object/error_code.cpp

37 lines
905 B
C++

#include "matador/object/error_code.hpp"
namespace matador::object {
const char * object_category_impl::name() const noexcept {
return "sql";
}
std::string object_category_impl::message(const int ev) const {
switch (static_cast<error_code>(ev)) {
case error_code::OK:
return "OK";
case error_code::NodeNotFound:
return "Node not found";
case error_code::NodeAlreadyExists:
return "Node already exists";
case error_code::Failure:
return "Failure";
default:
return "Unknown error";
}
}
const std::error_category & object_category() {
static object_category_impl instance;
return instance;
}
std::error_code make_error_code(error_code e) {
return {static_cast<int>(e), object_category()};
}
std::error_condition make_error_condition(error_code e) {
return {static_cast<int>(e), object_category()};
}
}