8 //! \brief Basic error handling (signaling) routines.
18 * \brief Generic exception class.
20 * \todo Do we need this?
22 * \todo Don't we need different kind of exceptions for different kind
24 * Shouldn't we use <stdexcept> instead?
26 class Exception : public std::exception {
28 std::ostringstream buf;
31 explicit Exception(const std::string &s) { buf << s; }
32 Exception(const Exception &e) : std::exception() {
35 virtual ~Exception() throw() {}
37 virtual const char* what() const throw() {
38 return buf.str().c_str();
41 Exception& operator<<(std::string const& s) { buf << s; return *this; }
42 Exception& operator<<(char const *s) { buf << s; return *this; }
43 Exception& operator<<(int i) { buf << i; return *this; }
47 * \brief Generic error signaling function.
49 * \todo Do we really need this? Is it helpful?
51 inline void fault(const std::string &msg) {
56 * \brief Macro for mark not yet implemented features.
58 * \todo Is this the right place for this? It should be used only in
59 * modules under development.
63 do { throw ::hugo::Exception() << "FIXME: " msg " (in: " \
64 __FILE__ ", " << __LINE__ << ")"; \
68 #endif // HUGO_ERROR_H