aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2006-01-19 19:16:26 +0000
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2006-01-19 19:16:26 +0000
commitb3bee5ca170f676e47932700e230441374c79b48 (patch)
treecadfe6d79547ec5cca3eec184f5d2fdde5c68323
parentceed973f970024dd406a68afbb0e8891a5b1b9d5 (diff)
downloadpaludis-b3bee5ca170f676e47932700e230441374c79b48.tar.gz
paludis-b3bee5ca170f676e47932700e230441374c79b48.tar.xz
Switch to using PALUDIS_HERE rather than __PRETTY_FUNCTION__. Make the test framework print out more exception information where it is available. We use a linker trick to avoid having libpaludistest.a require libpaludis.a.
-rw-r--r--paludis/Makefile.am.m43
-rw-r--r--paludis/config_file_TEST.cc1
-rw-r--r--paludis/default_environment.cc6
-rw-r--r--paludis/dep_list.cc4
-rw-r--r--paludis/dep_parser.cc14
-rw-r--r--paludis/dir_iterator.cc2
-rw-r--r--paludis/exception_to_debug_string.cc20
-rw-r--r--paludis/exception_to_debug_string.hh34
-rw-r--r--paludis/fake_repository.cc12
-rw-r--r--paludis/fs_entry.cc2
-rw-r--r--paludis/internal_error.cc8
-rw-r--r--paludis/internal_error.hh14
-rw-r--r--paludis/package_database.cc2
-rw-r--r--paludis/package_dep_atom.cc10
-rw-r--r--paludis/portage_repository.cc20
-rw-r--r--paludis/version_operator.cc6
-rw-r--r--test/test_framework.cc12
17 files changed, 118 insertions, 52 deletions
diff --git a/paludis/Makefile.am.m4 b/paludis/Makefile.am.m4
index 1399573..720811d 100644
--- a/paludis/Makefile.am.m4
+++ b/paludis/Makefile.am.m4
@@ -7,8 +7,9 @@ define(`filelist', `')dnl
define(`testlist', `')dnl
define(`testscriptlist', `')dnl
define(`addtest', `define(`testlist', testlist `$1_TEST')dnl
-$1_TEST_SOURCES = $1_TEST.cc
+$1_TEST_SOURCES = $1_TEST.cc exception_to_debug_string.hh exception_to_debug_string.cc
$1_TEST_LDADD = $(top_builddir)/test/libtest.a libpaludis.a
+$1_TEST_CPPFLAGS = -DPALUDIS_TEST_CASE=1
')dnl
define(`addtestscript', `define(`testscriptlist', testscriptlist `$1_TEST_setup.sh $1_TEST_cleanup.sh')')dnl
define(`addhh', `define(`filelist', filelist `$1.hh')')dnl
diff --git a/paludis/config_file_TEST.cc b/paludis/config_file_TEST.cc
index 1371a76..d103e90 100644
--- a/paludis/config_file_TEST.cc
+++ b/paludis/config_file_TEST.cc
@@ -18,6 +18,7 @@
* Place, Suite 330, Boston, MA 02111-1307 USA
*/
+#include "stringify.hh"
#include "config_file.hh"
#include <test/test_framework.hh>
#include <test/test_runner.hh>
diff --git a/paludis/default_environment.cc b/paludis/default_environment.cc
index 53b2980..625b4d5 100644
--- a/paludis/default_environment.cc
+++ b/paludis/default_environment.cc
@@ -73,7 +73,7 @@ DefaultEnvironment::query_use(const UseFlagName & f, const PackageDatabaseEntry
continue;
}
- throw InternalError(__PRETTY_FUNCTION__, "bad state");
+ throw InternalError(PALUDIS_HERE, "bad state");
#endif
} while (false);
@@ -102,7 +102,7 @@ DefaultEnvironment::query_use(const UseFlagName & f, const PackageDatabaseEntry
continue;
}
- throw InternalError(__PRETTY_FUNCTION__, "bad state " + stringify(state));
+ throw InternalError(PALUDIS_HERE, "bad state " + stringify(state));
} while (false);
switch (package_db()->fetch_repository(e.get<pde_repository>())->query_use(f))
@@ -115,7 +115,7 @@ DefaultEnvironment::query_use(const UseFlagName & f, const PackageDatabaseEntry
return true;
}
- throw InternalError(__PRETTY_FUNCTION__, "bad state");
+ throw InternalError(PALUDIS_HERE, "bad state");
}
bool
diff --git a/paludis/dep_list.cc b/paludis/dep_list.cc
index 486ae6f..06108b6 100644
--- a/paludis/dep_list.cc
+++ b/paludis/dep_list.cc
@@ -303,7 +303,7 @@ void
DepList::visit(const UseDepAtom * const u)
{
if (! _implementation->current_package)
- throw InternalError(__PRETTY_FUNCTION__, "current_package is 0");
+ throw InternalError(PALUDIS_HERE, "current_package is 0");
if (_implementation->environment->query_use(u->flag(),
*_implementation->current_package) ^ u->inverse())
@@ -348,7 +348,7 @@ DepList::visit(const AnyDepAtom * const a)
std::list<DepAtom::ConstPointer> viable_children;
if (0 == _implementation->current_package)
- throw InternalError(__PRETTY_FUNCTION__, "current_package is 0");
+ throw InternalError(PALUDIS_HERE, "current_package is 0");
std::copy(a->begin(), a->end(), filter_inserter(
std::back_inserter(viable_children), IsViable(*_implementation)));
diff --git a/paludis/dep_parser.cc b/paludis/dep_parser.cc
index 4729c0c..f2b2d20 100644
--- a/paludis/dep_parser.cc
+++ b/paludis/dep_parser.cc
@@ -138,7 +138,7 @@ DepParser::parse(const std::string & s)
continue;
}
- throw InternalError(__PRETTY_FUNCTION__,
+ throw InternalError(PALUDIS_HERE,
"dps_initial: i->first is " + stringify(i->first));
} while (0);
@@ -160,7 +160,7 @@ DepParser::parse(const std::string & s)
case dpl_close_paren:
throw DepStringParseError(s, "Expected space after '||'");
}
- throw InternalError(__PRETTY_FUNCTION__,
+ throw InternalError(PALUDIS_HERE,
"dps_had_double_bar: i->first is " + stringify(i->first));
} while (0);
@@ -182,7 +182,7 @@ DepParser::parse(const std::string & s)
case dpl_close_paren:
throw DepStringParseError(s, "Expected '(' after '|| '");
}
- throw InternalError(__PRETTY_FUNCTION__,
+ throw InternalError(PALUDIS_HERE,
"dps_had_double_bar_space: i->first is " + stringify(i->first));
} while (0);
continue;
@@ -203,7 +203,7 @@ DepParser::parse(const std::string & s)
case dpl_close_paren:
throw DepStringParseError(s, "Expected space after '(' or ')'");
}
- throw InternalError(__PRETTY_FUNCTION__,
+ throw InternalError(PALUDIS_HERE,
"dps_had_paren: i->first is " + stringify(i->first));
} while (0);
continue;
@@ -224,7 +224,7 @@ DepParser::parse(const std::string & s)
case dpl_close_paren:
throw DepStringParseError(s, "Expected space after use flag");
}
- throw InternalError(__PRETTY_FUNCTION__,
+ throw InternalError(PALUDIS_HERE,
"dps_had_use_flag: i->first is " + stringify(i->first));
} while (0);
continue;
@@ -245,12 +245,12 @@ DepParser::parse(const std::string & s)
case dpl_close_paren:
throw DepStringParseError(s, "Expected '(' after use flag");
}
- throw InternalError(__PRETTY_FUNCTION__,
+ throw InternalError(PALUDIS_HERE,
"dps_had_use_flag_space: i->first is " + stringify(i->first));
} while (0);
continue;
}
- throw InternalError(__PRETTY_FUNCTION__,
+ throw InternalError(PALUDIS_HERE,
"state is " + stringify(state));
} while (0);
diff --git a/paludis/dir_iterator.cc b/paludis/dir_iterator.cc
index 60da68a..c7a1dda 100644
--- a/paludis/dir_iterator.cc
+++ b/paludis/dir_iterator.cc
@@ -114,7 +114,7 @@ DirIterator::operator== (const DirIterator & other) const
return _iter == _items->end();
if (other._items != _items)
- throw InternalError(__PRETTY_FUNCTION__,
+ throw InternalError(PALUDIS_HERE,
"comparing two different DirIterators.");
return other._iter == _iter;
diff --git a/paludis/exception_to_debug_string.cc b/paludis/exception_to_debug_string.cc
new file mode 100644
index 0000000..4160c6c
--- /dev/null
+++ b/paludis/exception_to_debug_string.cc
@@ -0,0 +1,20 @@
+/* vim: set sw=4 sts=4 et foldmethod=syntax : */
+
+#include "exception_to_debug_string.hh"
+
+using namespace paludis;
+
+#ifdef PALUDIS_TEST_CASE
+
+std::string exception_to_debug_string(const std::exception & e)
+{
+ const paludis::Exception * ee;
+ if (0 != ((ee = dynamic_cast<const Exception *>(&e))))
+ return stringify(ee->what()) + " (message " + ee->message() +
+ (ee->empty() ? stringify("") : ", backtrace " + ee->backtrace(" -> ")) + ")";
+ else
+ return e.what();
+}
+
+#endif
+
diff --git a/paludis/exception_to_debug_string.hh b/paludis/exception_to_debug_string.hh
new file mode 100644
index 0000000..f2c5373
--- /dev/null
+++ b/paludis/exception_to_debug_string.hh
@@ -0,0 +1,34 @@
+/* vim: set sw=4 sts=4 et foldmethod=syntax : */
+
+/*
+ * Copyright (c) 2006 Ciaran McCreesh <ciaranm@gentoo.org>
+ *
+ * This file is part of the Paludis package manager. Paludis is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU General
+ * Public License as published by the Free Software Foundation; either version
+ * 2 of the License, or (at your option) any later version.
+ *
+ * Paludis is distributed in the hope that it will be useful, but WITHOUT ANY
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+ * details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+ * Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#ifndef PALUDIS_GUARD_PALUDIS_EXCEPTION_TO_DEBUG_STRING_HH
+#define PALUDIS_GUARD_PALUDIS_EXCEPTION_TO_DEBUG_STRING_HH 1
+
+#include <paludis/stringify.hh>
+#include <paludis/exception.hh>
+#include <exception>
+
+#ifdef PALUDIS_TEST_CASE
+
+std::string exception_to_debug_string(const std::exception & e);
+
+#endif
+
+#endif
diff --git a/paludis/fake_repository.cc b/paludis/fake_repository.cc
index bc71b1c..784e0e2 100644
--- a/paludis/fake_repository.cc
+++ b/paludis/fake_repository.cc
@@ -93,7 +93,7 @@ QualifiedPackageNameCollection::ConstPointer
FakeRepository::do_package_names(const CategoryNamePart & c) const
{
if (! has_category_named(c))
- throw InternalError(__PRETTY_FUNCTION__, "no category named " + stringify(c));
+ throw InternalError(PALUDIS_HERE, "no category named " + stringify(c));
QualifiedPackageNameCollection::Pointer result(new QualifiedPackageNameCollection);
PackageNamePartCollection::Iterator p(_implementation->package_names.find(c)->second->begin()),
p_end(_implementation->package_names.find(c)->second->end());
@@ -106,9 +106,9 @@ VersionSpecCollection::ConstPointer
FakeRepository::do_version_specs(const QualifiedPackageName & n) const
{
if (! has_category_named(n.get<qpn_category>()))
- throw InternalError(__PRETTY_FUNCTION__, "no category");
+ throw InternalError(PALUDIS_HERE, "no category");
if (! has_package_named(n.get<qpn_category>(), n.get<qpn_package>()))
- throw InternalError(__PRETTY_FUNCTION__, "no package");
+ throw InternalError(PALUDIS_HERE, "no package");
return _implementation->versions.find(n)->second;
}
@@ -117,9 +117,9 @@ FakeRepository::do_has_version(const CategoryNamePart & c,
const PackageNamePart & p, const VersionSpec & v) const
{
if (! has_category_named(c))
- throw InternalError(__PRETTY_FUNCTION__, "no category");
+ throw InternalError(PALUDIS_HERE, "no category");
if (! has_package_named(c, p))
- throw InternalError(__PRETTY_FUNCTION__, "no package");
+ throw InternalError(PALUDIS_HERE, "no package");
return _implementation->versions.find(QualifiedPackageName(c, p))->second->find(v) !=
_implementation->versions.find(QualifiedPackageName(c, p))->second->end();
}
@@ -160,7 +160,7 @@ FakeRepository::do_version_metadata(
const CategoryNamePart & c, const PackageNamePart & p, const VersionSpec & v) const
{
if (! has_version(c, p, v))
- throw InternalError(__PRETTY_FUNCTION__, "no version");
+ throw InternalError(PALUDIS_HERE, "no version");
return _implementation->metadata.find(stringify(c) + "/" + stringify(p) + "-" + stringify(v))->second;
}
diff --git a/paludis/fs_entry.cc b/paludis/fs_entry.cc
index bd9f3ec..4f3dd92 100644
--- a/paludis/fs_entry.cc
+++ b/paludis/fs_entry.cc
@@ -160,7 +160,7 @@ FSEntry::_normalise()
catch (const std::exception & e)
{
Context c("When normalising FSEntry path '" + _path + "':");
- throw InternalError(__PRETTY_FUNCTION__,
+ throw InternalError(PALUDIS_HERE,
"caught std::exception '" + stringify(e.what()) + "'");
}
}
diff --git a/paludis/internal_error.cc b/paludis/internal_error.cc
index 03fbff1..0bb6d5f 100644
--- a/paludis/internal_error.cc
+++ b/paludis/internal_error.cc
@@ -21,13 +21,13 @@
using namespace paludis;
-InternalError::InternalError(const char * const function, const std::string & message) throw () :
- Exception("Eek! Internal error at " + std::string(function) + ": " + message)
+InternalError::InternalError(const std::string & where, const std::string & message) throw () :
+ Exception("Eek! Internal error at " + where + ": " + message)
{
}
-InternalError::InternalError(const char * const function) throw () :
- Exception("Eek! Internal error at " + std::string(function))
+InternalError::InternalError(const std::string & where) throw () :
+ Exception("Eek! Internal error at " + where)
{
}
diff --git a/paludis/internal_error.hh b/paludis/internal_error.hh
index 9cb0a11..26153af 100644
--- a/paludis/internal_error.hh
+++ b/paludis/internal_error.hh
@@ -21,6 +21,7 @@
#define PALUDIS_GUARD_PALUDIS_INTERNAL_ERROR_HH 1
#include <paludis/exception.hh>
+#include <paludis/stringify.hh>
/** \file
* Declaration for the InternalError exception class.
@@ -38,24 +39,25 @@ namespace paludis
/**
* Constructor.
*
- * \param function Should be set to the __PRETTY_FUNCTION__ magic
- * constant.
+ * \param function Should be set to the PALUDIS_HERE macro.
*
* \param message A short message.
*/
- InternalError(const char * const function, const std::string & message) throw ();
+ InternalError(const std::string & where, const std::string & message) throw ();
/**
* Constructor, with no message (deprecated).
*
- * \param function Should be set to the __PRETTY_FUNCTION__ magic
- * constant.
+ * \param function Should be set to the PALUDIS_HERE macro.
*
* \deprecated Use paludis::InternalError::InternalError(const char * const,
* const std::string &) instead.
*/
- InternalError(const char * const function) throw () PALUDIS_ATTRIBUTE((deprecated));
+ InternalError(const std::string & where) throw () PALUDIS_ATTRIBUTE((deprecated));
};
}
+#define PALUDIS_HERE (paludis::stringify(__PRETTY_FUNCTION__) + " at " + \
+ paludis::stringify(__FILE__) + ":" + paludis::stringify(__LINE__))
+
#endif
diff --git a/paludis/package_database.cc b/paludis/package_database.cc
index 2dc83c0..3e0d96f 100644
--- a/paludis/package_database.cc
+++ b/paludis/package_database.cc
@@ -176,7 +176,7 @@ PackageDatabase::better_repository(const RepositoryName & r1,
return r1;
}
- throw InternalError(__PRETTY_FUNCTION__, "todo"); /// \bug
+ throw InternalError(PALUDIS_HERE, "todo"); /// \bug
}
RepositoryName
diff --git a/paludis/package_dep_atom.cc b/paludis/package_dep_atom.cc
index fa4f732..40bc31c 100644
--- a/paludis/package_dep_atom.cc
+++ b/paludis/package_dep_atom.cc
@@ -59,7 +59,7 @@ PackageDepAtom::PackageDepAtom(const std::string & s) :
try
{
if (s.empty())
- throw InternalError(__PRETTY_FUNCTION__, "todo"); /// \bug
+ throw InternalError(PALUDIS_HERE, "todo"); /// \bug
if (std::string::npos != std::string("<>=~").find(s.at(0)))
{
@@ -72,10 +72,10 @@ PackageDepAtom::PackageDepAtom(const std::string & s) :
while (true)
{
if (p >= s.length())
- throw InternalError(__PRETTY_FUNCTION__, "todo"); /// \bug
+ throw InternalError(PALUDIS_HERE, "todo"); /// \bug
q = s.find('-', q + 1);
if (++q >= s.length())
- throw InternalError(__PRETTY_FUNCTION__, "todo"); /// \bug
+ throw InternalError(PALUDIS_HERE, "todo"); /// \bug
if (s.at(q) >= '0' && s.at(q) <= '9')
break;
}
@@ -84,7 +84,7 @@ PackageDepAtom::PackageDepAtom(const std::string & s) :
if ('*' == s.at(s.length() - 1))
{
if (_version_operator != vo_equal)
- throw InternalError(__PRETTY_FUNCTION__, "todo"); /// \bug
+ throw InternalError(PALUDIS_HERE, "todo"); /// \bug
_version_operator = vo_equal_star;
_version_spec = CountedPtr<VersionSpec, count_policy::ExternalCountTag>(
new VersionSpec(s.substr(q, s.length() - q - 1)));
@@ -102,7 +102,7 @@ PackageDepAtom::PackageDepAtom(const std::string & s) :
}
catch (const std::exception & e)
{
- throw InternalError(__PRETTY_FUNCTION__, "caught std::exception '"
+ throw InternalError(PALUDIS_HERE, "caught std::exception '"
+ stringify(e.what()) + "'");
}
}
diff --git a/paludis/portage_repository.cc b/paludis/portage_repository.cc
index fc29a1d..6cc7de2 100644
--- a/paludis/portage_repository.cc
+++ b/paludis/portage_repository.cc
@@ -106,18 +106,18 @@ Implementation<PortageRepository>::add_profile(const FSEntry & f) const
Context context("When reading profile directory '" + stringify(f) + "':");
if (! f.is_directory())
- throw InternalError(__PRETTY_FUNCTION__, "todo"); /// \bug exception
+ throw InternalError(PALUDIS_HERE, "todo"); /// \bug exception
if ((f / "parent").exists())
{
std::ifstream parent_file(stringify(f / "parent").c_str());
if (! parent_file)
- throw InternalError(__PRETTY_FUNCTION__, "todo"); /// \bug exception
+ throw InternalError(PALUDIS_HERE, "todo"); /// \bug exception
LineConfigFile parent(&parent_file);
if (parent.begin() != parent.end())
add_profile((f / *parent.begin()).realpath());
else
- throw InternalError(__PRETTY_FUNCTION__, "todo"); /// \bug exception
+ throw InternalError(PALUDIS_HERE, "todo"); /// \bug exception
}
if ((f / "make.defaults").exists())
@@ -126,7 +126,7 @@ Implementation<PortageRepository>::add_profile(const FSEntry & f) const
std::ifstream make_defaults_file(stringify(f / "make.defaults").c_str());
if (! make_defaults_file)
- throw InternalError(__PRETTY_FUNCTION__, "todo"); /// \bug exception
+ throw InternalError(PALUDIS_HERE, "todo"); /// \bug exception
KeyValueConfigFile make_defaults_f(&make_defaults_file);
std::vector<std::string> uses;
tokeniser.tokenise(make_defaults_f.get("USE"), std::back_inserter(uses));
@@ -144,7 +144,7 @@ Implementation<PortageRepository>::add_profile(const FSEntry & f) const
{
std::ifstream use_mask_file(stringify(f / "use.mask").c_str());
if (! use_mask_file)
- throw InternalError(__PRETTY_FUNCTION__, "todo"); /// \bug exception
+ throw InternalError(PALUDIS_HERE, "todo"); /// \bug exception
LineConfigFile use_mask_f(&use_mask_file);
for (LineConfigFile::Iterator line(use_mask_f.begin()), line_end(use_mask_f.end()) ;
line != line_end ; ++line)
@@ -242,7 +242,7 @@ PortageRepository::do_package_names(const CategoryNamePart & c) const
need_category_names();
/// \todo
- throw InternalError(__PRETTY_FUNCTION__, "not implemented");
+ throw InternalError(PALUDIS_HERE, "not implemented");
return QualifiedPackageNameCollection::Pointer(new QualifiedPackageNameCollection);
}
@@ -291,7 +291,7 @@ PortageRepository::need_category_names() const
"profiles/categories").c_str());
if (! cat_file)
- throw InternalError(__PRETTY_FUNCTION__, "todo"); /// \bug real exception needed
+ throw InternalError(PALUDIS_HERE, "todo"); /// \bug real exception needed
LineConfigFile cats(&cat_file);
@@ -386,7 +386,7 @@ PortageRepository::do_version_metadata(
std::string line;
if (! cache)
- throw InternalError(__PRETTY_FUNCTION__, "todo");
+ throw InternalError(PALUDIS_HERE, "todo");
/// \bug this lot
std::getline(cache, line); result->set(vmk_depend, line);
@@ -412,7 +412,7 @@ PortageRepository::do_version_metadata(
result->set(vmk_keywords, "*");
}
else
- throw InternalError(__PRETTY_FUNCTION__, "not implemented"); /// \todo
+ throw InternalError(PALUDIS_HERE, "not implemented"); /// \todo
_implementation->metadata.insert(std::make_pair(std::make_pair(QualifiedPackageName(c, p), v), result));
return result;
@@ -429,7 +429,7 @@ PortageRepository::do_query_repository_masks(const CategoryNamePart & c,
std::ifstream f(stringify(_implementation->location / "profiles" / "package.mask").c_str());
if (! f)
- throw InternalError(__PRETTY_FUNCTION__, "todo"); /// \bug exception
+ throw InternalError(PALUDIS_HERE, "todo"); /// \bug exception
LineConfigFile ff(&f);
for (LineConfigFile::Iterator line(ff.begin()), line_end(ff.end()) ;
line != line_end ; ++line)
diff --git a/paludis/version_operator.cc b/paludis/version_operator.cc
index 04193c2..12212e0 100644
--- a/paludis/version_operator.cc
+++ b/paludis/version_operator.cc
@@ -56,7 +56,7 @@ VersionOperator::_decode(const std::string & v)
}
}
- throw InternalError(__PRETTY_FUNCTION__, "todo"); /// \bug
+ throw InternalError(PALUDIS_HERE, "todo"); /// \bug
}
std::ostream &
@@ -98,7 +98,7 @@ paludis::operator<< (std::ostream & s, const VersionOperator & v)
break;
}
- throw InternalError(__PRETTY_FUNCTION__, "v._v is " + stringify(v._v));
+ throw InternalError(PALUDIS_HERE, "v._v is " + stringify(v._v));
} while (false);
@@ -129,6 +129,6 @@ bool (VersionSpec::* VersionOperator::as_version_spec_operator() const)(const Ve
break;
}
- throw InternalError(__PRETTY_FUNCTION__, "_v is " + stringify(_v));
+ throw InternalError(PALUDIS_HERE, "_v is " + stringify(_v));
}
diff --git a/test/test_framework.cc b/test/test_framework.cc
index 46574a9..ed03958 100644
--- a/test/test_framework.cc
+++ b/test/test_framework.cc
@@ -19,6 +19,7 @@
*/
#include "test_framework.hh"
+#include <paludis/attributes.hh>
#include <iostream>
#include <algorithm>
#include <unistd.h>
@@ -31,6 +32,13 @@
using namespace test;
+std::string exception_to_debug_string(const std::exception &) PALUDIS_ATTRIBUTE((weak));
+
+std::string exception_to_debug_string(const std::exception & e)
+{
+ return e.what();
+}
+
#ifndef DOXYGEN
std::list<std::string>
@@ -100,7 +108,7 @@ TestCase::call_run()
catch (std::exception &e)
{
throw TestFailedException(__PRETTY_FUNCTION__, __FILE__, __LINE__,
- "Test threw unexpected exception " + paludis::stringify(e.what()));
+ "Test threw unexpected exception " + exception_to_debug_string(e));
}
catch (...)
{
@@ -165,7 +173,7 @@ class RunTest
}
catch (std::exception &e)
{
- std::cout << "!{" << e.what() << "} " << std::flush;
+ std::cout << "!{" << exception_to_debug_string(e) << "} " << std::flush;
had_local_failure = true;
*_had_a_failure = true;
}