summaryrefslogtreecommitdiff
path: root/src/dcp.cc
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2014-05-03 15:05:33 +0100
committerCarl Hetherington <cth@carlh.net>2014-05-03 15:05:33 +0100
commitfe9bbdf3f5223ee94cb51ba00ddab7f4a6ddb754 (patch)
tree1d7ff4b95d3a65989c3cb136ae338e59ca5251b1 /src/dcp.cc
parent9f5a1507380c52338765477da7cbe378b68870d9 (diff)
Use exceptions to hold errors even in the keep_going case.
Diffstat (limited to 'src/dcp.cc')
-rw-r--r--src/dcp.cc12
1 files changed, 7 insertions, 5 deletions
diff --git a/src/dcp.cc b/src/dcp.cc
index c0d148c5..dc0ffeaa 100644
--- a/src/dcp.cc
+++ b/src/dcp.cc
@@ -69,17 +69,19 @@ DCP::DCP (boost::filesystem::path directory)
}
template<class T> void
-survivable_error (bool keep_going, list<string>* errors, T const & e)
+survivable_error (bool keep_going, list<shared_ptr<DCPReadError> >* errors, T const & e)
{
- if (keep_going && errors) {
- errors->push_back (e.what ());
+ if (keep_going) {
+ if (errors) {
+ errors->push_back (shared_ptr<T> (new T (e)));
+ }
} else {
throw e;
}
}
void
-DCP::read (bool keep_going, list<string>* errors)
+DCP::read (bool keep_going, list<shared_ptr<DCPReadError> >* errors)
{
/* Read the ASSETMAP */
@@ -112,7 +114,7 @@ DCP::read (bool keep_going, list<string>* errors)
boost::filesystem::path path = _directory / i->second;
if (!boost::filesystem::exists (path)) {
- survivable_error (keep_going, errors, FileError ("file not found", path, -1));
+ survivable_error (keep_going, errors, MissingAssetError (path));
continue;
}