Commit d4a2c864 authored by Stephen Morris's avatar Stephen Morris
Browse files

[trac542] Update format of message

... and catch both isc::Exception and std::exception.
parent ab5868a8
......@@ -8,4 +8,7 @@ libutil_unittests_la_SOURCES += run_all.h run_all.cc
libutil_unittests_la_SOURCES += testdata.h testdata.cc
libutil_unittests_la_SOURCES += textdata.h
libutil_unittests_ls_LDADD = $(top_builddir)/src/lib/util/io/libutil_io.la
libutil_unittests_ls_LDADD += $(top_builddir)/src/lib/util/libutil.la
CLEANFILES = *.gcno *.gcda
......@@ -18,6 +18,7 @@
#include <iomanip>
#include <gtest/gtest.h>
#include <exceptions/exceptions.h>
#include <util/unittests/run_all.h>
namespace isc {
......@@ -31,10 +32,18 @@ run_all() {
if (getenv("B10TEST_CATCH_EXCEPTION")) {
try {
ret = RUN_ALL_TESTS();
} catch (const isc::Exception& ex) {
std::cerr << "*** isc::exception of class '" << typeid(ex).name()
<< "' was thrown:\n"
<< " file: " << ex.getFile() << "\n"
<< " line: " << ex.getLine() << "\n"
<< " what: " << ex.what() << std::endl;
throw;
} catch (const std::exception& ex) {
std::cerr << "***EXCEPTION: an exception of class '"
<< typeid(ex).name() << "' was thrown, what(): "
<< ex.what() << std::endl;
std::cerr << "*** std::exception of class '"
<< typeid(ex).name()
<< "' was thrown:\n"
<< " what: " << ex.what() << std::endl;
throw;
}
} else {
......
......@@ -17,6 +17,10 @@
#ifndef __RUN_ALL_H
#define __RUN_ALL_H
// Avoid need for user to include this header file.
#include <gtest/gtest.h>
namespace isc {
namespace util {
namespace unittests {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment