#pragma once #ifndef FSPP_FUSE_FUSEERRNOEXCEPTION_H_ #define FSPP_FUSE_FUSEERRNOEXCEPTION_H_ #include #include namespace fspp { namespace fuse{ class FuseErrnoException: public std::runtime_error { public: FuseErrnoException(int errno_); virtual ~FuseErrnoException(); int getErrno() const; private: int _errno; }; inline void CHECK_RETVAL(int retval) { if (retval < 0) { throw FuseErrnoException(errno); } } inline FuseErrnoException::FuseErrnoException(int errno_) :runtime_error(strerror(errno_)), _errno(errno_) { assert(_errno != 0); } inline FuseErrnoException::~FuseErrnoException() { } inline int FuseErrnoException::getErrno() const { return _errno; } } } #endif /* FSPP_FUSE_FUSEERRNOEXCEPTION_H_ */