added error message to invalid_torrent_file exception (will be replaced by error_code at some point)

This commit is contained in:
Arvid Norberg 2009-02-07 19:18:48 +00:00
parent cf55883d0f
commit 7744718b44
3 changed files with 12 additions and 9 deletions

View File

@ -157,7 +157,10 @@ namespace libtorrent
#ifndef BOOST_NO_EXCEPTIONS #ifndef BOOST_NO_EXCEPTIONS
struct TORRENT_EXPORT invalid_torrent_file: std::exception 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 #endif

View File

@ -4643,7 +4643,7 @@ namespace libtorrent
// ---- WEB SEEDS ---- // ---- WEB SEEDS ----
ptime now = time_now(); 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<web_seed_entry, ptime>::iterator iter_t; typedef std::map<web_seed_entry, ptime>::iterator iter_t;
for (iter_t i = m_web_seeds_next_retry.begin(); i != m_web_seeds_next_retry.end();) for (iter_t i = m_web_seeds_next_retry.begin(); i != m_web_seeds_next_retry.end();)
{ {

View File

@ -295,7 +295,7 @@ namespace libtorrent
std::string error; std::string error;
#ifndef BOOST_NO_EXCEPTIONS #ifndef BOOST_NO_EXCEPTIONS
if (!parse_torrent_file(e, error)) if (!parse_torrent_file(e, error))
throw invalid_torrent_file(); throw invalid_torrent_file(error);
#else #else
parse_torrent_file(e, error); parse_torrent_file(e, error);
#endif #endif
@ -312,7 +312,7 @@ namespace libtorrent
std::string error; std::string error;
#ifndef BOOST_NO_EXCEPTIONS #ifndef BOOST_NO_EXCEPTIONS
if (!parse_torrent_file(torrent_file, error)) if (!parse_torrent_file(torrent_file, error))
throw invalid_torrent_file(); throw invalid_torrent_file(error);
#else #else
parse_torrent_file(torrent_file, error); parse_torrent_file(torrent_file, error);
#endif #endif
@ -330,7 +330,7 @@ namespace libtorrent
lazy_bdecode(buffer, buffer + size, e); lazy_bdecode(buffer, buffer + size, e);
#ifndef BOOST_NO_EXCEPTIONS #ifndef BOOST_NO_EXCEPTIONS
if (!parse_torrent_file(e, error)) if (!parse_torrent_file(e, error))
throw invalid_torrent_file(); throw invalid_torrent_file(error);
#else #else
parse_torrent_file(e, error); parse_torrent_file(e, error);
#endif #endif
@ -360,7 +360,7 @@ namespace libtorrent
if (buf.empty()) if (buf.empty())
#ifndef BOOST_NO_EXCEPTIONS #ifndef BOOST_NO_EXCEPTIONS
throw invalid_torrent_file(); throw invalid_torrent_file("file not found");
#else #else
return; return;
#endif #endif
@ -370,7 +370,7 @@ namespace libtorrent
std::string error; std::string error;
#ifndef BOOST_NO_EXCEPTIONS #ifndef BOOST_NO_EXCEPTIONS
if (!parse_torrent_file(e, error)) if (!parse_torrent_file(e, error))
throw invalid_torrent_file(); throw invalid_torrent_file(error);
#else #else
parse_torrent_file(e, error); parse_torrent_file(e, error);
#endif #endif
@ -389,7 +389,7 @@ namespace libtorrent
if (buf.empty()) if (buf.empty())
#ifndef BOOST_NO_EXCEPTIONS #ifndef BOOST_NO_EXCEPTIONS
throw invalid_torrent_file(); throw invalid_torrent_file("empty file");
#else #else
return; return;
#endif #endif
@ -399,7 +399,7 @@ namespace libtorrent
std::string error; std::string error;
#ifndef BOOST_NO_EXCEPTIONS #ifndef BOOST_NO_EXCEPTIONS
if (!parse_torrent_file(e, error)) if (!parse_torrent_file(e, error))
throw invalid_torrent_file(); throw invalid_torrent_file(error);
#else #else
parse_torrent_file(e, error); parse_torrent_file(e, error);
#endif #endif