aboutsummaryrefslogtreecommitdiff
path: root/src/common/Exception.cpp
diff options
context:
space:
mode:
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