summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarius Kintel <marius@kintel.net>2012-10-09 00:49:02 (GMT)
committerMarius Kintel <marius@kintel.net>2012-10-09 00:49:02 (GMT)
commit087b9bb7c3462894acd5d527f32c4b43bedf6fdb (patch)
tree236093cb5760e0577961594835c40b194be1e446
parent750e1f9f649e0908bf1d89c9e31d61ef0f56fe7f (diff)
Catch exceptions as const references. Related to #204
-rw-r--r--src/CGAL_Nef_polyhedron.cc2
-rw-r--r--src/cgalutils.cc2
-rw-r--r--src/cgalworker.cc2
-rw-r--r--src/dxfdata.cc2
-rw-r--r--src/dxftess-cgal.cc2
-rw-r--r--src/export.cc4
-rw-r--r--src/import.cc2
-rw-r--r--src/mainwin.cc2
-rw-r--r--src/openscad.cc2
-rw-r--r--src/surface.cc2
10 files changed, 11 insertions, 11 deletions
diff --git a/src/CGAL_Nef_polyhedron.cc b/src/CGAL_Nef_polyhedron.cc
index ba298ad..56232a3 100644
--- a/src/CGAL_Nef_polyhedron.cc
+++ b/src/CGAL_Nef_polyhedron.cc
@@ -101,7 +101,7 @@ PolySet *CGAL_Nef_polyhedron::convertToPolyset()
this->p3->convert_to_Polyhedron(P);
ps = createPolySetFromPolyhedron(P);
}
- catch (CGAL::Precondition_exception e) {
+ catch (const CGAL::Precondition_exception &e) {
PRINTB("CGAL error in CGAL_Nef_polyhedron::convertToPolyset(): %s", e.what());
}
CGAL::set_error_behaviour(old_behaviour);
diff --git a/src/cgalutils.cc b/src/cgalutils.cc
index e39c495..a1c7dc2 100644
--- a/src/cgalutils.cc
+++ b/src/cgalutils.cc
@@ -136,7 +136,7 @@ CGAL_Polyhedron *createPolyhedronFromPolySet(const PolySet &ps)
CGAL_Build_PolySet builder(ps);
P->delegate(builder);
}
- catch (CGAL::Assertion_exception e) {
+ catch (const CGAL::Assertion_exception &e) {
PRINTB("CGAL error in CGAL_Build_PolySet: %s", e.what());
delete P;
P = NULL;
diff --git a/src/cgalworker.cc b/src/cgalworker.cc
index 30bb1fe..96fead9 100644
--- a/src/cgalworker.cc
+++ b/src/cgalworker.cc
@@ -31,7 +31,7 @@ void CGALWorker::work()
CGALEvaluator evaluator(*this->tree);
root_N = new CGAL_Nef_polyhedron(evaluator.evaluateCGALMesh(*this->tree->root()));
}
- catch (ProgressCancelException e) {
+ catch (const ProgressCancelException &e) {
PRINT("Rendering cancelled.");
}
diff --git a/src/dxfdata.cc b/src/dxfdata.cc
index 4258a4c..2fd40ab 100644
--- a/src/dxfdata.cc
+++ b/src/dxfdata.cc
@@ -141,7 +141,7 @@ DxfData::DxfData(double fn, double fs, double fa,
try {
id = boost::lexical_cast<int>(id_str);
}
- catch (boost::bad_lexical_cast &blc) {
+ catch (const boost::bad_lexical_cast &blc) {
if (!stream.eof()) {
PRINTB("WARNING: Illegal ID '%s' in `%s'", id_str % filename);
}
diff --git a/src/dxftess-cgal.cc b/src/dxftess-cgal.cc
index f221e3a..d01c1d5 100644
--- a/src/dxftess-cgal.cc
+++ b/src/dxftess-cgal.cc
@@ -166,7 +166,7 @@ void dxf_tesselate(PolySet *ps, DxfData &dxf, double rot, bool up, bool /* do_tr
}
}
- catch (CGAL::Assertion_exception e) {
+ catch (const CGAL::Assertion_exception &e) {
PRINTB("CGAL error in dxf_tesselate(): %s", e.what());
CGAL::set_error_behaviour(old_behaviour);
return;
diff --git a/src/export.cc b/src/export.cc
index 40ce6cb..80670ea 100644
--- a/src/export.cc
+++ b/src/export.cc
@@ -111,7 +111,7 @@ void export_stl(CGAL_Nef_polyhedron *root_N, std::ostream &output)
setlocale(LC_NUMERIC, ""); // Set default locale
}
- catch (CGAL::Assertion_exception e) {
+ catch (const CGAL::Assertion_exception &e) {
PRINTB("CGAL error in CGAL_Nef_polyhedron3::convert_to_Polyhedron(): %s", e.what());
}
CGAL::set_error_behaviour(old_behaviour);
@@ -125,7 +125,7 @@ void export_off(CGAL_Nef_polyhedron *root_N, std::ostream &output)
root_N->p3->convert_to_Polyhedron(P);
output << P;
}
- catch (CGAL::Assertion_exception e) {
+ catch (const CGAL::Assertion_exception &e) {
PRINTB("CGAL error in CGAL_Nef_polyhedron3::convert_to_Polyhedron(): %s", e.what());
}
CGAL::set_error_behaviour(old_behaviour);
diff --git a/src/import.cc b/src/import.cc
index 1073459..40d34fa 100644
--- a/src/import.cc
+++ b/src/import.cc
@@ -157,7 +157,7 @@ PolySet *ImportNode::evaluate_polyset(class PolySetEvaluator *) const
vdata[i][v] = boost::lexical_cast<double>(results[v+1]);
}
}
- catch (boost::bad_lexical_cast &blc) {
+ catch (const boost::bad_lexical_cast &blc) {
PRINTB("WARNING: Can't parse vertex line '%s'.", line);
i = 10;
continue;
diff --git a/src/mainwin.cc b/src/mainwin.cc
index 6bdcd70..4b0df70 100644
--- a/src/mainwin.cc
+++ b/src/mainwin.cc
@@ -709,7 +709,7 @@ void MainWindow::compileCSG(bool procevents)
PolySetCache::instance()->print();
CGALCache::instance()->print();
}
- catch (ProgressCancelException e) {
+ catch (const ProgressCancelException &e) {
PRINT("CSG generation cancelled.");
}
progress_report_fin();
diff --git a/src/openscad.cc b/src/openscad.cc
index 49c39da..df7adb3 100644
--- a/src/openscad.cc
+++ b/src/openscad.cc
@@ -153,7 +153,7 @@ int main(int argc, char **argv)
try {
po::store(po::command_line_parser(argc, argv).options(all_options).positional(p).run(), vm);
}
- catch(std::exception &e) { // Catches e.g. unknown options
+ catch(const std::exception &e) { // Catches e.g. unknown options
fprintf(stderr, "%s\n", e.what());
help(argv[0]);
}
diff --git a/src/surface.cc b/src/surface.cc
index 2fa3717..4339ead 100644
--- a/src/surface.cc
+++ b/src/surface.cc
@@ -134,7 +134,7 @@ PolySet *SurfaceNode::evaluate_polyset(class PolySetEvaluator *) const
min_val = std::min(v-1, min_val);
}
}
- catch (boost::bad_lexical_cast &blc) {
+ catch (const boost::bad_lexical_cast &blc) {
if (!stream.eof()) {
PRINTB("WARNING: Illegal value in '%s': %s", filename % blc.what());
}
contact: Jan Huwald // Impressum