p->parse_file (path.string());
} catch (std::exception& e) {
delete p;
- continue;
+ throw DCPReadError(String::compose("XML error in %1", path.string()), e.what());
}
string const root = p->get_document()->get_root_node()->get_name ();
{
}
+
+DCPReadError::DCPReadError (string message, string detail)
+ : runtime_error(String::compose("%1 (%2)", message, detail))
+ , _message(message)
+ , _detail(detail)
+{
+
+}
/*
- Copyright (C) 2012-2014 Carl Hetherington <cth@carlh.net>
+ Copyright (C) 2012-2018 Carl Hetherington <cth@carlh.net>
This file is part of libdcp.
#define LIBDCP_EXCEPTIONS_H
#include <boost/filesystem.hpp>
+#include <boost/optional.hpp>
/** @file src/exceptions.h
* @brief Exceptions thrown by libdcp.
{
public:
explicit DCPReadError (std::string message)
- : std::runtime_error (message)
+ : std::runtime_error(message)
{}
+
+ DCPReadError (std::string message, std::string detail);
+
+ std::string message () const {
+ return _message;
+ }
+
+ boost::optional<std::string> detail () const {
+ return _detail;
+ }
+
+private:
+ std::string _message;
+ boost::optional<std::string> _detail;
};
/** @class MissingAssetError