add error class

This commit is contained in:
MoAlyousef
2020-09-10 19:58:28 +03:00
parent b24df8406e
commit a6239fd335
12 changed files with 123 additions and 52 deletions
+20
View File
@@ -0,0 +1,20 @@
#include "error.h"
#include <assert.h>
namespace cmkr::error {
Status::Status(Code ec) noexcept : ec_(ec) {}
Status::operator int() noexcept { return static_cast<int>(ec_); }
} // namespace cmkr::error
const char *err_string[] = {
"Success", "Runtime error", "Initialization error", "CMake generation error", "Build error",
};
const char *cmkr_error_status(int i) {
assert(i >= 0 && i < 5);
return err_string[i];
}