aboutsummaryrefslogtreecommitdiff
path: root/include/cru/common/ErrnoException.hpp
diff options
context:
space:
mode:
authorcrupest <crupest@outlook.com>2022-01-15 18:34:55 +0800
committercrupest <crupest@outlook.com>2022-01-15 18:34:55 +0800
commit76b631144e008006efb3894c16e6fd04608d0b68 (patch)
treef676581ac216e910124dd42bd748d9f4a963217a /include/cru/common/ErrnoException.hpp
parentae638fc0c2cad09ae0ab69707852588aedc6e0df (diff)
downloadcru-76b631144e008006efb3894c16e6fd04608d0b68.tar.gz
cru-76b631144e008006efb3894c16e6fd04608d0b68.tar.bz2
cru-76b631144e008006efb3894c16e6fd04608d0b68.zip
...
Diffstat (limited to 'include/cru/common/ErrnoException.hpp')
-rw-r--r--include/cru/common/ErrnoException.hpp22
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