You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
cmkr/src/error.cpp

32 lines
698 B

#include "error.hpp"
4 years ago
3 years ago
#include <cassert>
#include <cstddef>
4 years ago
4 years ago
namespace cmkr {
namespace error {
4 years ago
Status::Status(Code ec) noexcept : ec_(ec) {
}
4 years ago
Status::operator int() const noexcept {
return static_cast<int>(ec_);
}
4 years ago
Status::Code Status::code() const noexcept {
return ec_;
}
4 years ago
4 years ago
} // namespace error
} // namespace cmkr
4 years ago
// strings for cmkr::error::Status::Code
static const char *err_string[] = {
"Success", "Runtime error", "Initialization error", "CMake generation error", "Build error", "Clean error", "Install error",
4 years ago
};
const char *cmkr_error_status(int i) {
assert(i >= 0 && static_cast<size_t>(i) < (sizeof(err_string) / sizeof(*(err_string))));
4 years ago
return err_string[i];
}