aboutsummaryrefslogtreecommitdiff
path: root/src/common/Exception.cpp
diff options
context:
space:
mode:
authorcrupest <crupest@outlook.com>2023-07-05 01:54:08 +0800
committercrupest <crupest@outlook.com>2023-07-05 01:54:08 +0800
commitbcfd51a7fabf7adf5f134247ca1020fac98b24b5 (patch)
tree41471cee6af6a7e49140e50ba818366b316c8ea7 /src/common/Exception.cpp
parentaa9bc6bb7c11e810745c80548dd5ed5b2cb08740 (diff)
downloadcru-bcfd51a7fabf7adf5f134247ca1020fac98b24b5.tar.gz
cru-bcfd51a7fabf7adf5f134247ca1020fac98b24b5.tar.bz2
cru-bcfd51a7fabf7adf5f134247ca1020fac98b24b5.zip
Add CFileStream. Move ErrnoException.
Diffstat (limited to 'src/common/Exception.cpp')
-rw-r--r--src/common/Exception.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/common/Exception.cpp b/src/common/Exception.cpp
index 86816720..b0053bac 100644
--- a/src/common/Exception.cpp
+++ b/src/common/Exception.cpp
@@ -1,5 +1,9 @@
#include "cru/common/Exception.h"
+#include "cru/common/Format.h"
+
+#include <cerrno>
+
namespace cru {
Exception::Exception() {}
@@ -14,4 +18,11 @@ const char* Exception::what() const noexcept {
return utf8_message_.c_str();
}
+
+ErrnoException::ErrnoException(const String& message)
+ : ErrnoException(message, errno) {}
+
+ErrnoException::ErrnoException(const String& message, int errno_code)
+ : Exception(Format(u"{}. Errno is {}.", message, errno_code)),
+ errno_code_(errno_code) {}
} // namespace cru