Commit 8a47d8d2 authored by JINMEI Tatuya's avatar JINMEI Tatuya

[trac613] catch exceptions by (const) reference.

parent 6bdfcf31
...@@ -170,10 +170,10 @@ ModuleCCSession::readModuleSpecification(const std::string& filename) { ...@@ -170,10 +170,10 @@ ModuleCCSession::readModuleSpecification(const std::string& filename) {
try { try {
module_spec = moduleSpecFromFile(file, true); module_spec = moduleSpecFromFile(file, true);
} catch (JSONError pe) { } catch (const JSONError& pe) {
cout << "Error parsing module specification file: " << pe.what() << endl; cout << "Error parsing module specification file: " << pe.what() << endl;
exit(1); exit(1);
} catch (ModuleSpecError dde) { } catch (const ModuleSpecError& dde) {
cout << "Error reading module specification file: " << dde.what() << endl; cout << "Error reading module specification file: " << dde.what() << endl;
exit(1); exit(1);
} }
......
...@@ -121,7 +121,7 @@ void ...@@ -121,7 +121,7 @@ void
check_module_specification(ConstElementPtr def) { check_module_specification(ConstElementPtr def) {
try { try {
check_data_specification(def); check_data_specification(def);
} catch (TypeError te) { } catch (const TypeError& te) {
throw ModuleSpecError(te.what()); throw ModuleSpecError(te.what());
} }
} }
......
...@@ -36,7 +36,7 @@ moduleSpecError(const std::string& file, ...@@ -36,7 +36,7 @@ moduleSpecError(const std::string& file,
EXPECT_THROW(moduleSpecFromFile(specfile(file)), ModuleSpecError); EXPECT_THROW(moduleSpecFromFile(specfile(file)), ModuleSpecError);
try { try {
ModuleSpec dd = moduleSpecFromFile(specfile(file)); ModuleSpec dd = moduleSpecFromFile(specfile(file));
} catch (ModuleSpecError dde) { } catch (const ModuleSpecError& dde) {
std::string ddew = dde.what(); std::string ddew = dde.what();
EXPECT_EQ(error1 + error2 + error3, ddew); EXPECT_EQ(error1 + error2 + error3, ddew);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment