Skip to content

Commit

Permalink
fix poor rethrows
Browse files Browse the repository at this point in the history
cppcheck (via Codacy) points out that it is better to rethrow the current event than to throw a new copy of it.
  • Loading branch information
GregoryLundberg committed Jan 28, 2018
1 parent b74df55 commit 45eae14
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/editor/map/map_context.cpp
Expand Up @@ -321,7 +321,7 @@ void map_context::load_scenario(const config& game_config)
read(scenario, *(preprocess_file(filename_)));
} catch(config::error& e) {
LOG_ED << "Caught a config error while parsing file: '" << filename_ << "'\n" << e.message << std::endl;
throw e;
throw;
}

scenario_id_ = scenario["id"].str();
Expand Down
2 changes: 1 addition & 1 deletion src/formula/formula.cpp
Expand Up @@ -963,7 +963,7 @@ class string_expression : public formula_expression
sub.calculation.reset(new formula(formula_str));
} catch(formula_error& e) {
e.filename += " - string substitution";
throw e;
throw;
}

subs_.push_back(sub);
Expand Down

0 comments on commit 45eae14

Please sign in to comment.