add missing header

self-hosting
MoAlyousef 4 years ago
parent 4688ba718c
commit 65d03aa50e

@ -8,6 +8,7 @@
#include <stdexcept> #include <stdexcept>
#include <stdlib.h> #include <stdlib.h>
#include <string> #include <string>
#include <system_error>
#include <toml.hpp> #include <toml.hpp>
namespace cmkr::build { namespace cmkr::build {
@ -53,6 +54,8 @@ int run(int argc, char **argv) {
int cmkr_build_run(int argc, char **argv) { int cmkr_build_run(int argc, char **argv) {
try { try {
return cmkr::build::run(argc, argv); return cmkr::build::run(argc, argv);
} catch (const std::system_error &e) {
return e.code().value();
} catch (...) { } catch (...) {
return cmkr::error::Status(cmkr::error::Status::Code::BuildError); return cmkr::error::Status(cmkr::error::Status::Code::BuildError);
} }

@ -13,7 +13,6 @@
#include <string_view> #include <string_view>
#include <toml.hpp> #include <toml.hpp>
namespace fs = std::filesystem; namespace fs = std::filesystem;
namespace cmkr::gen { namespace cmkr::gen {
@ -233,6 +232,8 @@ int generate_cmake(const char *path) {
int cmkr_gen_generate_project(const char *typ) { int cmkr_gen_generate_project(const char *typ) {
try { try {
return cmkr::gen::generate_project(typ); return cmkr::gen::generate_project(typ);
} catch (const std::system_error &e) {
return e.code().value();
} catch (...) { } catch (...) {
return cmkr::error::Status(cmkr::error::Status::Code::InitError); return cmkr::error::Status(cmkr::error::Status::Code::InitError);
} }
@ -241,6 +242,8 @@ int cmkr_gen_generate_project(const char *typ) {
int cmkr_gen_generate_cmake(const char *path) { int cmkr_gen_generate_cmake(const char *path) {
try { try {
return cmkr::gen::generate_cmake(path); return cmkr::gen::generate_cmake(path);
} catch (const std::system_error &e) {
return e.code().value();
} catch (...) { } catch (...) {
return cmkr::error::Status(cmkr::error::Status::Code::GenerationError); return cmkr::error::Status(cmkr::error::Status::Code::GenerationError);
} }

Loading…
Cancel
Save