Commit 3909b762 authored by Matthieu Dorier's avatar Matthieu Dorier
Browse files

corrected C++ exception

parent 43f3ad8d
...@@ -36,8 +36,13 @@ class exception : public std::exception { ...@@ -36,8 +36,13 @@ class exception : public std::exception {
public: public:
exception(int error) exception(int error)
: m_msg(std::string("[SDSKV] ") + sdskv_error_messages[-error]) : m_error(error) {
, m_error(error) {} if(error < 0 && error >= -16) {
m_msg = std::string("[SDSKV] ") + sdskv_error_messages[-error];
} else {
m_msg = std::string("[SDSKV] Unknown error code ") + std::to_string(error);
}
}
virtual const char* what() const noexcept override { virtual const char* what() const noexcept override {
return m_msg.c_str(); return m_msg.c_str();
......
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