Revision: 64322
http://sourceforge.net/p/brlcad/code/64322
Author: ejno
Date: 2015-03-01 17:41:30 +0000 (Sun, 01 Mar 2015)
Log Message:
-----------
improve error messages
Modified Paths:
--------------
brlcad/trunk/src/conv/3dm/3dm-g.cpp
brlcad/trunk/src/conv/3dm/conv3dm-g.cpp
Modified: brlcad/trunk/src/conv/3dm/3dm-g.cpp
===================================================================
--- brlcad/trunk/src/conv/3dm/3dm-g.cpp 2015-03-01 08:47:07 UTC (rev 64321)
+++ brlcad/trunk/src/conv/3dm/3dm-g.cpp 2015-03-01 17:41:30 UTC (rev 64322)
@@ -28,9 +28,11 @@
#include "common.h"
+#include "conv3dm-g.hpp"
+
#include <iostream>
+#include <stdexcept>
-#include "conv3dm-g.hpp"
#include "bu/getopt.h"
@@ -43,8 +45,8 @@
bool verbose_mode = false;
bool random_colors = false;
bool use_uuidnames = false;
- char* outputFileName = NULL;
- const char* inputFileName;
+ const char *output_path = NULL;
+ const char *input_path;
int c;
@@ -54,7 +56,7 @@
break;
case 'o': /* specify output file name */
- outputFileName = bu_optarg;
+ output_path = bu_optarg;
break;
case 'd': /* debug */
@@ -82,16 +84,25 @@
}
argv += bu_optind;
- inputFileName = argv[0];
+ input_path = argv[0];
- if (outputFileName == NULL) {
+ if (output_path == NULL) {
std::cerr << usage;
return 1;
}
- conv3dm::RhinoConverter converter(outputFileName, verbose_mode);
- converter.write_model(inputFileName, use_uuidnames, random_colors);
+ conv3dm::RhinoConverter converter(output_path, verbose_mode);
+ try {
+ converter.write_model(input_path, use_uuidnames, random_colors);
+ } catch (const std::logic_error &e) {
+ std::cerr << "Conversion failed: " << e.what() << '\n';
+ return 1;
+ } catch (const std::runtime_error &e) {
+ std::cerr << "Conversion failed: " << e.what() << '\n';
+ return 1;
+ }
+
return 0;
}
Modified: brlcad/trunk/src/conv/3dm/conv3dm-g.cpp
===================================================================
--- brlcad/trunk/src/conv/3dm/conv3dm-g.cpp 2015-03-01 08:47:07 UTC (rev
64321)
+++ brlcad/trunk/src/conv/3dm/conv3dm-g.cpp 2015-03-01 17:41:30 UTC (rev
64322)
@@ -418,7 +418,7 @@
object.m_name = unique_name(prefix, suffix);
if (!m_obj_map.insert(std::make_pair(uuid, object)).second)
- throw std::invalid_argument("uuid in use");
+ throw std::invalid_argument("duplicate uuid");
}
@@ -427,7 +427,7 @@
const ON_UUID &parent_uuid, const ON_UUID &member_uuid)
{
if (!m_obj_map[parent_uuid].m_members.insert(member_uuid).second)
- throw std::invalid_argument("member uuid already in use");
+ throw std::invalid_argument("duplicate member uuid");
}
@@ -596,7 +596,7 @@
}
if (num_problems != repair_count) {
- m_log.Print("Remaining problems:\n");
+ m_log.Print("Repair failed. Remaining problems:\n");
m_model.Audit(false, NULL, &m_log, NULL);
} else
m_log.Print("Repair successful; model is now valid.\n");
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
------------------------------------------------------------------------------
Dive into the World of Parallel Programming The Go Parallel Website, sponsored
by Intel and developed in partnership with Slashdot Media, is your hub for all
things parallel software development, from weekly thought leadership blogs to
news, videos, case studies, tutorials and more. Take a look and join the
conversation now. http://goparallel.sourceforge.net/
_______________________________________________
BRL-CAD Source Commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/brlcad-commits