exception: Add common file exceptions

Change-Id: Ie9a792fe850d18b3c7e3d6fe61b39c76558b5b37
Signed-off-by: William A. Kennington III <wak@google.com>
diff --git a/src/meson.build b/src/meson.build
index 046117b..09d8b0e 100644
--- a/src/meson.build
+++ b/src/meson.build
@@ -38,9 +38,8 @@
 
 stdplus_lib = library(
   'stdplus',
-  [
-    'stdplus/signal.cpp',
-  ],
+  'stdplus/exception.cpp',
+  'stdplus/signal.cpp',
   include_directories: stdplus_headers,
   implicit_include_directories: false,
   dependencies: stdplus_deps,
@@ -66,6 +65,7 @@
   requires: stdplus_reqs)
 
 install_headers(
+  'stdplus/exception.hpp',
   'stdplus/raw.hpp',
   'stdplus/signal.hpp',
   'stdplus/types.hpp',
diff --git a/src/stdplus/exception.cpp b/src/stdplus/exception.cpp
new file mode 100644
index 0000000..d51bd16
--- /dev/null
+++ b/src/stdplus/exception.cpp
@@ -0,0 +1,33 @@
+#include <stdplus/exception.hpp>
+
+namespace stdplus
+{
+namespace exception
+{
+
+WouldBlock::WouldBlock(const char* what) :
+    std::system_error(std::make_error_code(std::errc::operation_would_block),
+                      what)
+{
+}
+
+WouldBlock::WouldBlock(const std::string& what) :
+    std::system_error(std::make_error_code(std::errc::operation_would_block),
+                      what)
+{
+}
+
+Eof::Eof(const char* what) :
+    std::system_error(std::make_error_code(std::errc::no_message_available),
+                      what)
+{
+}
+
+Eof::Eof(const std::string& what) :
+    std::system_error(std::make_error_code(std::errc::no_message_available),
+                      what)
+{
+}
+
+} // namespace exception
+} // namespace stdplus
diff --git a/src/stdplus/exception.hpp b/src/stdplus/exception.hpp
new file mode 100644
index 0000000..efeb4c3
--- /dev/null
+++ b/src/stdplus/exception.hpp
@@ -0,0 +1,22 @@
+#pragma once
+#include <system_error>
+
+namespace stdplus
+{
+namespace exception
+{
+
+struct WouldBlock : public std::system_error
+{
+    WouldBlock(const char* what);
+    WouldBlock(const std::string& what);
+};
+
+struct Eof : public std::system_error
+{
+    Eof(const char* what);
+    Eof(const std::string& what);
+};
+
+} // namespace exception
+} // namespace stdplus