diff --git a/include/libtorrent/torrent_info.hpp b/include/libtorrent/torrent_info.hpp index 99d9f1f17..feff1b14c 100644 --- a/include/libtorrent/torrent_info.hpp +++ b/include/libtorrent/torrent_info.hpp @@ -157,7 +157,10 @@ namespace libtorrent #ifndef BOOST_NO_EXCEPTIONS struct TORRENT_EXPORT invalid_torrent_file: std::exception { - virtual const char* what() const throw() { return "invalid torrent file"; } + invalid_torrent_file(std::string const& s): m_error(s) {} + virtual const char* what() const throw() { return m_error.c_str(); } + virtual ~invalid_torrent_file() throw() {} + std::string m_error; }; #endif diff --git a/src/torrent.cpp b/src/torrent.cpp index e7a3cb9e8..28e989a8d 100644 --- a/src/torrent.cpp +++ b/src/torrent.cpp @@ -4643,7 +4643,7 @@ namespace libtorrent // ---- WEB SEEDS ---- ptime now = time_now(); - // re-insert urls that are to be retrieds into the m_web_seeds + // re-insert urls that are to be retried into the m_web_seeds typedef std::map::iterator iter_t; for (iter_t i = m_web_seeds_next_retry.begin(); i != m_web_seeds_next_retry.end();) { diff --git a/src/torrent_info.cpp b/src/torrent_info.cpp index 82b16720b..e06c0cc3e 100644 --- a/src/torrent_info.cpp +++ b/src/torrent_info.cpp @@ -295,7 +295,7 @@ namespace libtorrent std::string error; #ifndef BOOST_NO_EXCEPTIONS if (!parse_torrent_file(e, error)) - throw invalid_torrent_file(); + throw invalid_torrent_file(error); #else parse_torrent_file(e, error); #endif @@ -312,7 +312,7 @@ namespace libtorrent std::string error; #ifndef BOOST_NO_EXCEPTIONS if (!parse_torrent_file(torrent_file, error)) - throw invalid_torrent_file(); + throw invalid_torrent_file(error); #else parse_torrent_file(torrent_file, error); #endif @@ -330,7 +330,7 @@ namespace libtorrent lazy_bdecode(buffer, buffer + size, e); #ifndef BOOST_NO_EXCEPTIONS if (!parse_torrent_file(e, error)) - throw invalid_torrent_file(); + throw invalid_torrent_file(error); #else parse_torrent_file(e, error); #endif @@ -360,7 +360,7 @@ namespace libtorrent if (buf.empty()) #ifndef BOOST_NO_EXCEPTIONS - throw invalid_torrent_file(); + throw invalid_torrent_file("file not found"); #else return; #endif @@ -370,7 +370,7 @@ namespace libtorrent std::string error; #ifndef BOOST_NO_EXCEPTIONS if (!parse_torrent_file(e, error)) - throw invalid_torrent_file(); + throw invalid_torrent_file(error); #else parse_torrent_file(e, error); #endif @@ -389,7 +389,7 @@ namespace libtorrent if (buf.empty()) #ifndef BOOST_NO_EXCEPTIONS - throw invalid_torrent_file(); + throw invalid_torrent_file("empty file"); #else return; #endif @@ -399,7 +399,7 @@ namespace libtorrent std::string error; #ifndef BOOST_NO_EXCEPTIONS if (!parse_torrent_file(e, error)) - throw invalid_torrent_file(); + throw invalid_torrent_file(error); #else parse_torrent_file(e, error); #endif