aboutsummaryrefslogtreecommitdiff
path: root/src/posix_extras.h
diff options
context:
space:
mode:
authorGravatar Benjamin Barenblat <bbaren@mit.edu>2016-02-18 21:39:06 -0500
committerGravatar Benjamin Barenblat <bbaren@mit.edu>2016-02-18 22:15:48 -0500
commitd0f5817f4720b49ffaee9fa9593b2f11446963a0 (patch)
treed2ad6c43b4ff0ca04c490a5e0487ffb80ee1f272 /src/posix_extras.h
parent8716cf918e75c540814d75ccb9fa26ff6085cf63 (diff)
Add nullary constructor to IoError
The constructor constructs an IoError based on the current errno.
Diffstat (limited to 'src/posix_extras.h')
-rw-r--r--src/posix_extras.h3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/posix_extras.h b/src/posix_extras.h
index b9c0f12..001968f 100644
--- a/src/posix_extras.h
+++ b/src/posix_extras.h
@@ -15,6 +15,7 @@
#ifndef POSIX_EXTRAS_H_
#define POSIX_EXTRAS_H_
+#include <cerrno>
#include <stdexcept>
#include <string>
@@ -26,6 +27,8 @@ namespace scoville {
class IoError : public std::runtime_error {
public:
+ IoError() : IoError(errno) {}
+
explicit IoError(const int number)
: std::runtime_error(Message(number)), number_(number) {}