From 384c05188c458072a6534b05ca9b4c633149d8b0 Mon Sep 17 00:00:00 2001 From: Olivier Parcollet Date: Wed, 23 Apr 2014 18:47:17 +0200 Subject: [PATCH] exceptions handling : slight improve - separate the stack trace from the error message for better python handling - separate triqs::excption from triqs::runtime_error --- triqs/utility/exceptions.hpp | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/triqs/utility/exceptions.hpp b/triqs/utility/exceptions.hpp index 2b7145a7..e1e0496d 100644 --- a/triqs/utility/exceptions.hpp +++ b/triqs/utility/exceptions.hpp @@ -30,19 +30,26 @@ namespace triqs { - class runtime_error : public std::exception { - std::string acc; + class exception : public std::exception { + std::string acc, trace; public: - runtime_error() throw() :std::exception() {} - virtual ~runtime_error() throw() {} - template runtime_error & operator <<( T const & x) { std::stringstream f; f< exception & operator <<( T const & x) { std::stringstream f; f< runtime_error & operator <<( T && x) { exception::operator<<(x); return *this; } + }; } -#define TRIQS_ERROR(CLASS,NAME) throw CLASS()<<" Triqs "<