Skip to content

Commit

Permalink
refs #3868. catch exceptions by reference.
Browse files Browse the repository at this point in the history
  • Loading branch information
stuartcampbell committed Dec 19, 2011
1 parent 7112899 commit 72c2061
Show file tree
Hide file tree
Showing 15 changed files with 22 additions and 22 deletions.
2 changes: 1 addition & 1 deletion Code/Mantid/Framework/Algorithms/src/CorrectToFile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ void CorrectToFile::doWkspAlgebra(API::MatrixWorkspace_sptr lhs, API::MatrixWork
{
algebra->execute();
}
catch(std::runtime_error)
catch(std::runtime_error &)
{
g_log.warning() << "Error encountered while running algorithm " << algName << std::endl;
g_log.error() << "Correction file " << getPropertyValue("Filename") + " can't be used to correct workspace " << getPropertyValue("WorkspaceToCorrect") << std::endl;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ void CuboidGaugeVolumeAbsorption::initialiseCachedDistances()
try
{
FlatPlateAbsorption::initialiseCachedDistances();
} catch (Exception::InstrumentDefinitionError) {
} catch (Exception::InstrumentDefinitionError &) {
// Create and throw a new exception with a more specific message
throw Exception::InstrumentDefinitionError(
"This algorithm requires that the sample fully encloses the requested gauge volume.");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,7 @@ namespace Algorithms

ifs.close();

} catch (std::ifstream::failure e){
} catch (std::ifstream::failure & e){
// b. Using faking offset/calibration
g_log.error() << "Open calibration/offset file " << calfilename << " error " << std::endl;
g_log.notice() << "Using fake detector offset/calibration" << std::endl;
Expand Down
2 changes: 1 addition & 1 deletion Code/Mantid/Framework/Algorithms/src/FlatBackground.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ void FlatBackground::exec()
}
}
}
catch (std::exception)
catch (std::exception &)
{
g_log.error() << "Error processing the spectrum with index " << currentSpec << std::endl;
throw;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ void HRPDSlabCanAbsorption::exec()
try
{
det = workspace->getDetector(i);
} catch (Exception::NotFoundError)
} catch (Exception::NotFoundError &)
{
// Catch when a spectrum doesn't have an attached detector and go to next one
continue;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ namespace Mantid
}
}
//catch all exceptions because the solid angle calculation is optional
catch(std::exception e)
catch(std::exception & e)
{
g_log.warning(
"Precision warning: Can't find detector geometry " + name() +
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ void NormaliseToMonitor::checkProperties(API::MatrixWorkspace_sptr inputWorkspac
g_log.warning("The spectrum in MonitorWorkspace does not refer to a monitor.\n"
"Continuing with normalisation regardless.");
}
} catch (Kernel::Exception::NotFoundError) {
} catch (Kernel::Exception::NotFoundError &) {
g_log.warning("Unable to check if the spectrum provided relates to a monitor - "
"the instrument is not fully specified.\n"
"Continuing with normalisation regardless.");
Expand Down
2 changes: 1 addition & 1 deletion Code/Mantid/Framework/Algorithms/src/Regroup.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ void Regroup::exec()
if (inputW->getAxis(1)->unit().get())
outputW->getAxis(1)->unit() = inputW->getAxis(1)->unit();
}
catch(Exception::IndexError) {
catch(Exception::IndexError &) {
// OK, so this isn't a Workspace2D
}

Expand Down
2 changes: 1 addition & 1 deletion Code/Mantid/Framework/Algorithms/src/UnwrapSNS.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,7 @@ double UnwrapSNS::calculateFlightpath(const int& spectrum, bool& isMonitor) cons
Ld = det->getDistance(*(m_inputWS->getInstrument()->getSource()));
}
}
catch (Exception::NotFoundError)
catch (Exception::NotFoundError &)
{
// If the detector information is missing, return a negative number
}
Expand Down
4 changes: 2 additions & 2 deletions Code/Mantid/Framework/Algorithms/test/AlphaCalcTest.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ class AlphaCalcTest : public CxxTest::TestSuite
{
TS_ASSERT_EQUALS(alphaCalc.execute(),true);
}
catch(std::runtime_error e)
catch(std::runtime_error & e)
{
TS_FAIL(e.what());
}
Expand All @@ -82,7 +82,7 @@ class AlphaCalcTest : public CxxTest::TestSuite
{
TS_ASSERT_EQUALS(alphaCalc.execute(),true);
}
catch(std::runtime_error e)
catch(std::runtime_error & e)
{
TS_FAIL(e.what());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ class BinaryOperateMasksTest : public CxxTest::TestSuite
TS_ASSERT_EQUALS(ws3->getValue(2), 0);

}
catch(std::runtime_error e)
catch(std::runtime_error & e)
{
TS_FAIL(e.what());
}
Expand Down Expand Up @@ -114,7 +114,7 @@ class BinaryOperateMasksTest : public CxxTest::TestSuite
// std::cout << ih << " - " << tempdetid << ": " << ws1->getValue(tempdetid) << " vs. " << ws4->getValue(tempdetid) << std::endl;
}
}
catch(std::runtime_error e)
catch(std::runtime_error & e)
{
TS_FAIL(e.what());
}
Expand All @@ -133,7 +133,7 @@ class BinaryOperateMasksTest : public CxxTest::TestSuite
TS_ASSERT_EQUALS(ws2->getValue(tempdetid), 1);
}
}
catch(std::runtime_error e)
catch(std::runtime_error & e)
{
TS_FAIL(e.what());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ class CalMuonDeadTimeTest : public CxxTest::TestSuite
{
TS_ASSERT_EQUALS(calDeadTime.execute(),true);
}
catch(std::runtime_error e)
catch(std::runtime_error & e)
{
TS_FAIL(e.what());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ class MuonAsymmetryCalcTest : public CxxTest::TestSuite
{
TS_ASSERT_EQUALS(asymCalc.execute(),true);
}
catch(std::runtime_error e)
catch(std::runtime_error & e)
{
TS_FAIL(e.what());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ class MuonRemoveExpDecayTest : public CxxTest::TestSuite
{
TS_ASSERT_EQUALS(alg.execute(),true);
}
catch(std::runtime_error e)
catch(std::runtime_error & e)
{
TS_FAIL(e.what());
}
Expand All @@ -84,7 +84,7 @@ class MuonRemoveExpDecayTest : public CxxTest::TestSuite
{
TS_ASSERT_EQUALS(alg2.execute(),true);
}
catch(std::runtime_error e)
catch(std::runtime_error & e)
{
TS_FAIL(e.what());
}
Expand Down
8 changes: 4 additions & 4 deletions Code/Mantid/Framework/Algorithms/test/RemoveBinsTest.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ class RemoveBinsTest : public CxxTest::TestSuite
{
TS_ASSERT_EQUALS(alg.execute(),true);
}
catch(std::runtime_error e)
catch(std::runtime_error & e)
{
TS_FAIL(e.what());
}
Expand Down Expand Up @@ -89,7 +89,7 @@ class RemoveBinsTest : public CxxTest::TestSuite
{
TS_ASSERT_EQUALS(alg3.execute(),true);
}
catch(std::runtime_error e)
catch(std::runtime_error & e)
{
TS_FAIL(e.what());
}
Expand Down Expand Up @@ -126,7 +126,7 @@ class RemoveBinsTest : public CxxTest::TestSuite
{
TS_ASSERT_EQUALS(alg4.execute(),true);
}
catch(std::runtime_error e)
catch(std::runtime_error & e)
{
TS_FAIL(e.what());
}
Expand Down Expand Up @@ -197,7 +197,7 @@ class RemoveBinsTest : public CxxTest::TestSuite
{
TS_ASSERT_EQUALS(alg2.execute(),true);
}
catch(std::runtime_error e)
catch(std::runtime_error & e)
{
TS_FAIL(e.what());
}
Expand Down

0 comments on commit 72c2061

Please sign in to comment.