[Liblas-commits] hg-main-tree: add try/catch around the .write methods to catch a...

liblas-commits at liblas.org liblas-commits at liblas.org
Mon Jul 25 15:47:03 EDT 2011


details:   http://hg.libpc.orghg-main-tree/rev/0ae87c14148e
changeset: 927:0ae87c14148e
user:      Howard Butler <hobu.inc at gmail.com>
date:      Mon Jul 25 14:46:58 2011 -0500
description:
add try/catch around the .write methods to catch any std errors

diffstat:

 apps/pc2pc.cpp |  20 ++++++++++++++++++--
 1 files changed, 18 insertions(+), 2 deletions(-)

diffs (37 lines):

diff -r cf56cd8a7a0e -r 0ae87c14148e apps/pc2pc.cpp
--- a/apps/pc2pc.cpp	Mon Jul 25 14:40:39 2011 -0500
+++ b/apps/pc2pc.cpp	Mon Jul 25 14:46:58 2011 -0500
@@ -183,7 +183,15 @@
         // pdal::filters::ByteSwapFilter swapper(descalingFilter);
         pdal::drivers::oci::Writer writer(descalingFilter, options);
 
-        writer.write(numPoints);
+        try{
+            writer.write(numPoints);
+            
+        } catch (pdal::pdal_error& e)
+        {
+            std::cerr << "Error writing oracle: " << e.what() << std::endl;
+            
+        }
+
         boost::property_tree::ptree output_tree;
         // output_tree.put_child(writer.getName(), options.GetPTree());
         // boost::property_tree::write_xml(m_xml, output_tree);
@@ -240,7 +248,15 @@
             writer.setCompressed(true);
         writer.setChunkSize(oracle_options.get<boost::uint32_t>("capacity"));
         writer.setPointFormat(pdal::drivers::las::PointFormat3);
-        writer.write(0);
+        
+        try{
+            writer.write(0);
+            
+        } catch (pdal::pdal_error& e)
+        {
+            std::cerr << "Error reading oracle: " << e.what() << std::endl;
+            
+        }
             
 
     #else


More information about the Liblas-commits mailing list