Skip to content

Commit

Permalink
changes for exception handling (it was broken)
Browse files Browse the repository at this point in the history
to be cherry picked by master
  • Loading branch information
shiozaki committed Jul 25, 2018
1 parent 9348d8f commit 4b56242
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion src/global.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@

namespace bagel {

void static_variables();
extern void static_variables();

static void print_header() {
std::cout << std::endl;
Expand Down
11 changes: 5 additions & 6 deletions src/main.cc
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,12 @@ using namespace std;
using namespace bagel;

int main(int argc, char** argv) {
const bool input_provided = argc == 2;
if (!input_provided) {
throw runtime_error("no input file provided");
}
const string input = argv[1];

try {
const bool input_provided = argc == 2;
if (!input_provided)
throw runtime_error("no input file provided");
const string input = argv[1];

// this is the main driver
bagel::run_bagel_from_input(input);
} catch (const Termination& e) {
Expand Down
3 changes: 2 additions & 1 deletion src/run_bagel.cc
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,14 @@ namespace bagel { namespace impl {


void bagel::run_bagel_from_input(const string& input) {
static_variables();
auto idata = make_shared<const PTree>(input);
impl::run_bagel_(idata);
}


void bagel::run_bagel_from_json(const string& input) {
static_variables();
stringstream ss; ss << input;
auto idata = make_shared<const PTree>(ss);
impl::run_bagel_(idata);
Expand All @@ -60,7 +62,6 @@ void bagel::run_bagel_from_json(const string& input) {

void bagel::impl::run_bagel_(shared_ptr<const PTree> idata) {

static_variables();
print_header();

shared_ptr<const Geometry> geom;
Expand Down

0 comments on commit 4b56242

Please sign in to comment.