From fe9bbdf3f5223ee94cb51ba00ddab7f4a6ddb754 Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Sat, 3 May 2014 15:05:33 +0100 Subject: Use exceptions to hold errors even in the keep_going case. --- src/dcp.cc | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'src/dcp.cc') 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 void -survivable_error (bool keep_going, list* errors, T const & e) +survivable_error (bool keep_going, list >* errors, T const & e) { - if (keep_going && errors) { - errors->push_back (e.what ()); + if (keep_going) { + if (errors) { + errors->push_back (shared_ptr (new T (e))); + } } else { throw e; } } void -DCP::read (bool keep_going, list* errors) +DCP::read (bool keep_going, list >* errors) { /* Read the ASSETMAP */ @@ -112,7 +114,7 @@ DCP::read (bool keep_going, list* 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; } -- cgit v1.2.3