The Micro C++ Library
|
Declaration of class micxx::Exception and the macros __MICXXTRY__
and __MICXXEND__
.
More...
Classes | |
class | micxx::Exception |
An Exception is able to represent an error code, a message text and a stack of exception causes. More... | |
Namespaces | |
namespace | micxx |
The Micro C++ Library. | |
Defines | |
#define | __MICXXTRY__ |
This macro simply starts a nested try catch block. | |
#define | __MICXXEND__ |
This macro closes a nested try catch block that was previously started by __MICXXTRY__ . | |
Functions | |
template<typename Stream > | |
Stream & | operator<< (Stream &stream, const micxx::Exception &exception) |
Write an Exception to a std::ostream reference. |
Declaration of class micxx::Exception and the macros __MICXXTRY__
and __MICXXEND__
.
#define __MICXXEND__ |
} \ catch (const micxx::Exception & cause) \ { \ throw micxx::Exception(__FILE__, __LINE__, cause, \ cause.getCode(), __FUNCTION__); \ } \ catch (const std::exception & cause) \ { \ throw micxx::Exception(__FILE__, __LINE__, "from %s: %s", \ __FUNCTION__, cause.what()); \ } \ catch (...) \ { \ throw micxx::Exception(__FILE__, __LINE__, "from %s: %s", \ __FUNCTION__, "unknown exception"); \ }
This macro closes a nested try catch block that was previously started by __MICXXTRY__
.
All exceptions of a (derived) type
const std::exception &
and#define __MICXXTRY__ |
try \
{
This macro simply starts a nested try catch block.
Stream& operator<< | ( | Stream & | stream, |
const micxx::Exception & | exception | ||
) |
Write an Exception to a std::ostream reference.
{ stream << exception.getName(); if (exception.getFilename()) { stream << "(" << exception.getFilename() << "," << exception.getLine() << ")"; } if (exception.getCode()) { stream << ": " << exception.getCode(); } stream << std::endl << "\t"; stream << exception.getMessage(); if (exception.getCause()) { stream << " caused by" << std::endl << *exception.getCause(); } return stream; }