diff options
Diffstat (limited to 'include/cru/common/ErrnoException.hpp')
-rw-r--r-- | include/cru/common/ErrnoException.hpp | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/include/cru/common/ErrnoException.hpp b/include/cru/common/ErrnoException.hpp new file mode 100644 index 00000000..6feb1aca --- /dev/null +++ b/include/cru/common/ErrnoException.hpp @@ -0,0 +1,22 @@ +#pragma once + +#include "Exception.hpp" + +namespace cru { +class ErrnoException : public Exception { + public: + ErrnoException() : ErrnoException(String{}) {} + explicit ErrnoException(const String& message); + ErrnoException(const String& message, int errno_code); + + CRU_DELETE_COPY(ErrnoException) + CRU_DELETE_MOVE(ErrnoException) + + ~ErrnoException() override = default; + + int GetErrnoCode() const { return errno_code_; } + + private: + int errno_code_; +}; +} // namespace cru |