2014-11-15 15:16:18 +01:00
|
|
|
#pragma once
|
2014-11-16 00:05:28 +01:00
|
|
|
#ifndef FSPP_FUSE_FUSEERRNOEXCEPTION_H_
|
|
|
|
#define FSPP_FUSE_FUSEERRNOEXCEPTION_H_
|
2014-11-15 15:16:18 +01:00
|
|
|
|
|
|
|
#include <stdexcept>
|
|
|
|
#include <errno.h>
|
|
|
|
|
2014-11-16 00:05:28 +01:00
|
|
|
namespace fspp {
|
2014-11-15 15:16:18 +01:00
|
|
|
|
|
|
|
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);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-11-16 00:05:28 +01:00
|
|
|
} /* namespace fspp */
|
2014-11-15 15:16:18 +01:00
|
|
|
|
2014-11-16 00:05:28 +01:00
|
|
|
#endif /* FSPP_FUSE_FUSEERRNOEXCEPTION_H_ */
|