diff options
author | Marcin Junczys-Dowmunt <junczys@amu.edu.pl> | 2017-03-24 00:29:34 +0300 |
---|---|---|
committer | Marcin Junczys-Dowmunt <junczys@amu.edu.pl> | 2017-03-24 00:29:34 +0300 |
commit | 8b93fc7146b826dc3254a244b172829bb0ede957 (patch) | |
tree | ce7480435156e7f100efe5127c45a44562ee1417 | |
parent | a539ef17a585db15d4911b75e2d79d3e07fe2119 (diff) |
exception handling
-rw-r--r-- | src/amun/common/config.cpp | 11 | ||||
m--------- | src/marian | 11 |
2 files changed, 16 insertions, 6 deletions
diff --git a/src/amun/common/config.cpp b/src/amun/common/config.cpp index 4363657f..8cb03f18 100644 --- a/src/amun/common/config.cpp +++ b/src/amun/common/config.cpp @@ -332,7 +332,16 @@ void Config::AddOptions(size_t argc, char** argv) { if (Get<bool>("relative-paths") && !vm_["dump-config"].as<bool>()) ProcessPaths(config_, boost::filesystem::path{configPath}.parent_path(), false); - Validate(config_); + try { + Validate(config_); + } + catch(util::Exception& e) { + std::cerr << "Error: " << e.what() << std::endl << std::endl; + + std::cerr << "Usage: " + std::string(argv[0]) + " [options]" << std::endl; + std::cerr << cmdline_options << std::endl; + exit(1); + } if(vm_["dump-config"].as<bool>()) { YAML::Emitter emit; diff --git a/src/marian b/src/marian -Subproject 7f95e513a9d4bfa3f77f09eb195f8a998e0ad1e +Subproject e51310bd29bba0a05474a0c66bb05be55a47a80 |