Skip to content

Commit

Permalink
Fix exceptions caught by value.
Browse files Browse the repository at this point in the history
  • Loading branch information
kfindeisen committed Nov 5, 2019
1 parent 8df339f commit 3a1c23d
Show file tree
Hide file tree
Showing 20 changed files with 20 additions and 20 deletions.
2 changes: 1 addition & 1 deletion examples/convolveLinear.cc
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ int main(int argc, char **argv) {
try {
std::string dataDir = lsst::utils::getPackageDir("afwdata");
inImagePath = dataDir + "/data/med.fits";
} catch (lsst::pex::exceptions::NotFoundError) {
} catch (lsst::pex::exceptions::NotFoundError const&) {
std::cerr << "Usage: linearConvolve [fitsFile]" << std::endl;
std::cerr << "fitsFile is the path to a masked image" << std::endl;
std::cerr << "\nError: setup afwdata or specify fitsFile.\n" << std::endl;
Expand Down
2 changes: 1 addition & 1 deletion examples/decoratedImage.cc
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ int main(int argc, char* argv[]) {
try {
std::string dataDir = lsst::utils::getPackageDir("afwdata");
file_u16 = dataDir + "/data/small.fits";
} catch (lsst::pex::exceptions::NotFoundError) {
} catch (lsst::pex::exceptions::NotFoundError const&) {
std::cerr << "Error: provide fits file path as argument or setup afwdata.\n" << std::endl;
exit(EXIT_FAILURE);
}
Expand Down
2 changes: 1 addition & 1 deletion examples/mask.cc
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ int main() {
try {
std::string dataDir = lsst::utils::getPackageDir("afwdata");
inImagePath = dataDir + "/data/small.fits";
} catch (lsst::pex::exceptions::NotFoundError) {
} catch (lsst::pex::exceptions::NotFoundError const&) {
std::cerr << "Usage: mask [fitsFile]" << std::endl;
std::cerr << "fitsFile is the path to a masked image" << std::endl;
std::cerr << "\nError: setup afwdata or specify fitsFile.\n" << std::endl;
Expand Down
2 changes: 1 addition & 1 deletion examples/maskedImageFitsIo.cc
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ int main(int argc, char **argv) {
try {
std::string dataDir = lsst::utils::getPackageDir("afwdata");
inImagePath = dataDir + "/data/small.fits";
} catch (lsst::pex::exceptions::NotFoundError) {
} catch (lsst::pex::exceptions::NotFoundError const&) {
std::cerr << "Usage: maskedImageFitsIO [fitsFile]" << std::endl;
std::cerr << "fitsFile is the path to a masked image" << std::endl;
std::cerr << "\nError: setup afwdata or specify fitsFile.\n" << std::endl;
Expand Down
2 changes: 1 addition & 1 deletion examples/simpleConvolve.cc
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ int main(int argc, char **argv) {
try {
std::string dataDir = lsst::utils::getPackageDir("afwdata");
inImagePath = dataDir + "/data/small.fits";
} catch (lsst::pex::exceptions::NotFoundError) {
} catch (lsst::pex::exceptions::NotFoundError const&) {
std::cerr << "Usage: simpleConvolve [fitsFile [sigma]]" << std::endl;
std::cerr << "fitsFile is the path to a masked image" << std::endl;
std::cerr << "sigma (default " << DefSigma << ") is the width of the gaussian kernel, in pixels"
Expand Down
2 changes: 1 addition & 1 deletion examples/spatiallyVaryingConvolve.cc
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ int main(int argc, char **argv) {
try {
std::string dataDir = lsst::utils::getPackageDir("afwdata");
inImagePath = dataDir + "/data/small.fits";
} catch (lsst::pex::exceptions::NotFoundError) {
} catch (lsst::pex::exceptions::NotFoundError const&) {
std::cerr << "Usage: spatiallyVaryingConvolve [fitsFile]" << std::endl;
std::cerr << "fitsFile is the path to a masked image" << std::endl;
std::cerr << "\nError: setup afwdata or specify fitsFile.\n" << std::endl;
Expand Down
2 changes: 1 addition & 1 deletion examples/timeConvolve.cc
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ int main(int argc, char **argv) {
try {
std::string dataDir = lsst::utils::getPackageDir("afwdata");
inImagePath = dataDir + "/data/small.fits";
} catch (lsst::pex::exceptions::NotFoundError) {
} catch (lsst::pex::exceptions::NotFoundError const&) {
std::cerr << "Usage: timeConvolve [fitsFile [nIter]]" << std::endl;
std::cerr << "fitsFile is the path to a masked image" << std::endl;
std::cerr << "nIter (default " << DefNIter << ") is the number of iterations per kernel size"
Expand Down
2 changes: 1 addition & 1 deletion examples/timeWcs.cc
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ int main(int argc, char **argv) {
try {
std::string dataDir = lsst::utils::getPackageDir("afwdata");
inImagePath = dataDir + "/ImSim/calexp/v85408556-fr/R23/S11.fits";
} catch (lsst::pex::exceptions::NotFoundError) {
} catch (lsst::pex::exceptions::NotFoundError const&) {
std::cerr << "Usage: timeWcs [fitsFile [nIter]]" << std::endl;
std::cerr << "fitsFile is the path to an exposure" << std::endl;
std::cerr << "nIter (default " << DefNIter << ") is the number of iterations" << std::endl;
Expand Down
2 changes: 1 addition & 1 deletion examples/wcsTest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ int main(int argc, char **argv) {
try {
std::string dataDir = lsst::utils::getPackageDir("afwdata");
inImagePath = dataDir + "/data/medexp.fits";
} catch (lsst::pex::exceptions::NotFoundError) {
} catch (lsst::pex::exceptions::NotFoundError const&) {
std::cerr << "Usage: wcsTest [fitsFile]" << std::endl;
std::cerr << "fitsFile is the path to an exposure" << std::endl;
std::cerr << "\nError: setup afwdata or specify fitsFile.\n" << std::endl;
Expand Down
2 changes: 1 addition & 1 deletion src/geom/SpanSet.cc
Original file line number Diff line number Diff line change
Expand Up @@ -919,7 +919,7 @@ void SpanSet::setImage(image::Image<ImageT>& image, ImageT val, lsst::geom::Box2
} else {
applyFunctor(setterFunc, image, val);
}
} catch (pex::exceptions::OutOfRangeError e) {
} catch (pex::exceptions::OutOfRangeError const&) {
throw LSST_EXCEPT(pex::exceptions::OutOfRangeError,
"Footprint Bounds Outside image, set doClip to true");
}
Expand Down
2 changes: 1 addition & 1 deletion src/geom/detail/frameSetUtils.cc
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ std::shared_ptr<ast::FrameSet> readFitsWcs(daf::base::PropertySet& metadata, boo
std::shared_ptr<ast::Object> obj;
try {
obj = channel.read();
} catch (std::runtime_error) {
} catch (std::runtime_error const&) {
throw LSST_EXCEPT(pex::exceptions::TypeError, "The metadata does not describe an AST object");
}

Expand Down
2 changes: 1 addition & 1 deletion src/image/ExposureFitsReader.cc
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ class ExposureFitsReader::MetadataReader {
// Try to read WCS from image metadata, and if found, strip the keywords used
try {
wcs = afw::geom::makeSkyWcs(*imageMetadata, true);
} catch (lsst::pex::exceptions::TypeError) {
} catch (lsst::pex::exceptions::TypeError const&) {
LOGLS_DEBUG(_log, "No WCS found in FITS metadata");
}
if (wcs && any(xy0.ne(lsst::geom::Point2I(0, 0)))) {
Expand Down
2 changes: 1 addition & 1 deletion src/image/ExposureInfo.cc
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,7 @@ ExposureInfo::FitsWriteData ExposureInfo::_startWriteFits(lsst::geom::Point2I co
std::shared_ptr<daf::base::PropertyList> wcsMetadata;
try {
wcsMetadata = newWcs->getFitsMetadata(true);
} catch (pex::exceptions::RuntimeError) {
} catch (pex::exceptions::RuntimeError const&) {
// cannot represent this WCS as FITS-WCS; don't write its metadata
}
if (wcsMetadata) {
Expand Down
2 changes: 1 addition & 1 deletion src/image/MaskedImageFitsReader.cc
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ void checkExtType(ImageBaseFitsReader const & reader, std::shared_ptr<daf::base:
reader.getFileName() % reader.getHdu() % expected % exttype));
}
metadata->remove("EXTTYPE");
} catch (pex::exceptions::NotFoundError) {
} catch (pex::exceptions::NotFoundError const&) {
LOGL_WARN("afw.image.MaskedImageFitsReader", "Expected extension type not found: %s",
expected.c_str());
}
Expand Down
2 changes: 1 addition & 1 deletion src/image/PhotoCalib.cc
Original file line number Diff line number Diff line change
Expand Up @@ -510,7 +510,7 @@ class CalibFactory : public table::io::PersistableFactory {
int tableVersion = 1;
try {
catalogs.front().getSchema().find<double>(EXPTIME_FIELD_NAME);
} catch (pex::exceptions::NotFoundError) {
} catch (pex::exceptions::NotFoundError const&) {
tableVersion = CALIB_TABLE_CURRENT_VERSION;
}

Expand Down
2 changes: 1 addition & 1 deletion src/math/warpExposure.cc
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,7 @@ int warpImage(DestImageT &destImage, SrcImageT const &srcImage,
std::shared_ptr<SeparableKernel> warpingKernelPtr = control.getWarpingKernel();
try {
warpingKernelPtr->shrinkBBox(srcImage.getBBox(image::LOCAL));
} catch (lsst::pex::exceptions::InvalidParameterError) {
} catch (lsst::pex::exceptions::InvalidParameterError const&) {
for (int y = 0, height = destImage.getHeight(); y < height; ++y) {
for (typename DestImageT::x_iterator destPtr = destImage.row_begin(y), end = destImage.row_end(y);
destPtr != end; ++destPtr) {
Expand Down
2 changes: 1 addition & 1 deletion tests/background.cc
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ BOOST_AUTO_TEST_CASE(BackgroundTestImages,
std::string afwdata_dir;
try {
afwdata_dir = lsst::utils::getPackageDir("afwdata");
} catch (lsst::pex::exceptions::NotFoundError) {
} catch (lsst::pex::exceptions::NotFoundError const&) {
cerr << "Skipping: Test requires afwdata to be available" << endl;
return;
}
Expand Down
2 changes: 1 addition & 1 deletion tests/maskedImage1.cc
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ int test(int argc, char **argv) {
// twice in the previous avatar.
outImagePath1 = "tests/file:maskedImage1_output_1.fits";
outImagePath2 = "tests/file:maskedImage1_output_2.fits";
} catch (lsst::pex::exceptions::NotFoundError) {
} catch (lsst::pex::exceptions::NotFoundError const&) {
cerr << "Usage: inputBaseName1 inputBaseName2 outputBaseName1 outputBaseName2" << endl;
cerr << "Warning: tests not run! Setup afwdata if you wish to use the default fitsFile." << endl;
return EXIT_SUCCESS;
Expand Down
2 changes: 1 addition & 1 deletion tests/ramFitsIO.cc
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ string GetGFilenamePath(int argc, char **argv) {
// inImagePath = dataDir + "/data/fpC-002570-r6-0199_sub.fits"; //Also works - this one was not
// used at all in the previous avatar of this test.
inImagePath = dataDir + "/data/fpC-005902-r6-0677_sub.fits";
} catch (lsst::pex::exceptions::NotFoundError) {
} catch (lsst::pex::exceptions::NotFoundError const&) {
cerr << "Usage: maskedImage1 [inputBaseName1] [inputBaseName2] [outputBaseName1] "
"[outputBaseName2]"
<< endl;
Expand Down
2 changes: 1 addition & 1 deletion tests/statistics.cc
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ BOOST_AUTO_TEST_CASE(StatisticsTestImages,
std::string afwdata_dir;
try {
afwdata_dir = lsst::utils::getPackageDir("afwdata");
} catch (lsst::pex::exceptions::NotFoundError) {
} catch (lsst::pex::exceptions::NotFoundError const&) {
cerr << "Skipping: Test requires afwdata to be available" << endl;
return;
}
Expand Down

0 comments on commit 3a1c23d

Please sign in to comment.