Commit 65480a97 authored by Matthieu Dorier's avatar Matthieu Dorier

starting point for a C++ interface

parent 5d17b351
This diff is collapsed.
#ifndef __SDSKV_COMMON_HPP
#define __SDSKV_COMMON_HPP
namespace sdskv {
const char const sdskv_error_messages[] = {
"",
"Allocation error",
"Invalid argument",
"Mercury error",
"Could not create database",
"Invalid database name",
"Invalid database id",
"Invalid provider id",
"Error writing in the database",
"Unknown key",
"Provided buffer size too small",
"Error erasing from the database",
"Migration error",
"Function not implemented",
"Invalid comparison function",
"REMI error",
"Argobots error"
};
class exception : public std::exception {
std::string m_msg;
int m_error;
static const
public:
exception(int error)
: m_msg(std::string("[SDSKV] ") + sdskv_error_messages[-error])
, m_error(error) {}
const char* what() const {
return m_msg.c_str();
}
int error() const {
return m_error;
}
};
}
#endif
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment