#ifndef errno_exception_h #define errno_exception_h // errno_exception.h #include #include #include #include /// Exception lancé lorsqu'une erreur est retournée par la libc. class errno_exception : public std::exception { int errno_; std::string what_; public: errno_exception (const std::string &desc, int errno__) : errno_ (errno__), what_ (desc + ": " + strerror (errno__)) { } errno_exception (int errno__) : errno_ (errno__), what_ (strerror (errno__)) { } ~errno_exception (void) throw () { } virtual const char* what () const throw () { return what_.c_str (); } int getErrno (void) const { return errno_; } }; #endif // errno_exception_h