X-Git-Url: http://g0dil.de/git?a=blobdiff_plain;f=Utils%2FException.cc;h=f94be754b992e56b8ee7a70c0dd2aa627f18619d;hb=24ccc14a000ffeceb9e5b6d02f54d2e971a3aee8;hp=ade974acfdf5c61e9b742925af4418aeb95f93b2;hpb=85ab07d100a382467a42e19d741d403a7a96c951;p=senf.git diff --git a/Utils/Exception.cc b/Utils/Exception.cc index ade974a..f94be75 100644 --- a/Utils/Exception.cc +++ b/Utils/Exception.cc @@ -1,9 +1,9 @@ // $Id$ // // Copyright (C) 2006 -// Fraunhofer Institut fuer offene Kommunikationssysteme (FOKUS) -// Kompetenzzentrum fuer Satelitenkommunikation (SatCom) -// Stefan Bund +// Fraunhofer Institute for Open Communication Systems (FOKUS) +// Competence Center NETwork research (NET), St. Augustin, GERMANY +// Stefan Bund // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by @@ -27,28 +27,36 @@ //#include "Exception.ih" // Custom includes -#include -#include #define prefix_ ///////////////////////////////cc.p//////////////////////////////////////// -prefix_ void senf::SystemException::init() +/////////////////////////////////////////////////////////////////////////// +// senf::Exception + +prefix_ senf::Exception::~Exception() + throw() +{} + +prefix_ char const * senf::Exception::what() + const throw() { - // We normallyl don't want to consume memory in an exception, - // however all other solutions to format the message are terribly - // ugly (since thay must use a static and shared buffer ...) - std::stringstream s; - if (where) - s << where << ": "; - s << "(" << err << ") " << std::strerror(err); - buffer_ = s.str(); + return message_.c_str(); } -prefix_ char const * senf::SystemException::what() - const throw() +/////////////////////////////////////////////////////////////////////////// +// senf::SystemException + +prefix_ void senf::SystemException::init(std::string const & descr, int code + _SENF_EXC_DEBUG_ARGS_ND) { - return buffer_.c_str(); + code_ = code; +# ifdef SENF_DEBUG + if (file && line) + (*this) << "Exception at " << file << ":" << line << "\n"; +# endif + (*this) << "[" << errorString() << "]"; + if (! descr.empty()) (*this) << " " << descr; } ///////////////////////////////cc.e//////////////////////////////////////// @@ -61,4 +69,6 @@ prefix_ char const * senf::SystemException::what() // c-file-style: "senf" // indent-tabs-mode: nil // ispell-local-dictionary: "american" +// compile-command: "scons -u test" +// comment-column: 40 // End: