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 ...@@ -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 += testdata.h testdata.cc
libutil_unittests_la_SOURCES += textdata.h 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 CLEANFILES = *.gcno *.gcda
...@@ -18,6 +18,7 @@ ...@@ -18,6 +18,7 @@
#include <iomanip> #include <iomanip>
#include <gtest/gtest.h> #include <gtest/gtest.h>
#include <exceptions/exceptions.h>
#include <util/unittests/run_all.h> #include <util/unittests/run_all.h>
namespace isc { namespace isc {
...@@ -31,10 +32,18 @@ run_all() { ...@@ -31,10 +32,18 @@ run_all() {
if (getenv("B10TEST_CATCH_EXCEPTION")) { if (getenv("B10TEST_CATCH_EXCEPTION")) {
try { try {
ret = RUN_ALL_TESTS(); 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) { } catch (const std::exception& ex) {
std::cerr << "***EXCEPTION: an exception of class '" std::cerr << "*** std::exception of class '"
<< typeid(ex).name() << "' was thrown, what(): " << typeid(ex).name()
<< ex.what() << std::endl; << "' was thrown:\n"
<< " what: " << ex.what() << std::endl;
throw; throw;
} }
} else { } else {
......
...@@ -17,6 +17,10 @@ ...@@ -17,6 +17,10 @@
#ifndef __RUN_ALL_H #ifndef __RUN_ALL_H
#define __RUN_ALL_H #define __RUN_ALL_H
// Avoid need for user to include this header file.
#include <gtest/gtest.h>
namespace isc { namespace isc {
namespace util { namespace util {
namespace unittests { 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