#ifndef _EXCEPTIONS_HH_ #define _EXCEPTIONS_HH_ #include namespace ex { // An unexcpected fatal error occured class error { public: error(int eno = 0) : eno_(eno) { } int getErrno() const { return eno_; } private: int eno_; }; // A memory allocation, or virtual address space allocation, failed class bad_alloc : public error { public: bad_alloc() : error(ENOMEM) { } }; // An operation timed out class timeout : public error { public: timeout() : error(EAGAIN) { } }; } #endif