diff options
| author | Carl Hetherington <cth@carlh.net> | 2014-05-03 15:05:33 +0100 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2014-05-03 15:05:33 +0100 |
| commit | fe9bbdf3f5223ee94cb51ba00ddab7f4a6ddb754 (patch) | |
| tree | 1d7ff4b95d3a65989c3cb136ae338e59ca5251b1 /src/dcp.cc | |
| parent | 9f5a1507380c52338765477da7cbe378b68870d9 (diff) | |
Use exceptions to hold errors even in the keep_going case.
Diffstat (limited to 'src/dcp.cc')
| -rw-r--r-- | src/dcp.cc | 12 |
1 files changed, 7 insertions, 5 deletions
@@ -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; } |
