exception: add errno for all exceptions

sd_bus maintains an errno for all exceptions.  There are some
users of the library that are catching an SdBusError because they
want an easy way to change to an errno, but as a result they are
potentially missing exceptions.  Add the `get_errno` method into
our base exception object and return the same default that sd_bus
uses: EIO.

Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
Change-Id: I5d7610f78934c94841f99573db6adca2b5ec895c
diff --git a/include/sdbusplus/exception.hpp b/include/sdbusplus/exception.hpp
index 1a83a09..7099c79 100644
--- a/include/sdbusplus/exception.hpp
+++ b/include/sdbusplus/exception.hpp
@@ -19,6 +19,7 @@
 {
     virtual const char* name() const noexcept = 0;
     virtual const char* description() const noexcept = 0;
+    virtual int get_errno() const noexcept;
 };
 
 /** base exception class for all errors generated by sdbusplus itself. */
@@ -45,7 +46,7 @@
     const char* name() const noexcept override;
     const char* description() const noexcept override;
     const char* what() const noexcept override;
-    int get_errno() const noexcept;
+    int get_errno() const noexcept override;
     const sd_bus_error* get_error() const noexcept;
 
   private:
diff --git a/src/exception.cpp b/src/exception.cpp
index b58bd01..641659e 100644
--- a/src/exception.cpp
+++ b/src/exception.cpp
@@ -1,5 +1,6 @@
 #include <sdbusplus/exception.hpp>
 
+#include <cerrno>
 #include <stdexcept>
 #include <utility>
 
@@ -13,6 +14,11 @@
 namespace exception
 {
 
+int exception::get_errno() const noexcept
+{
+    return EIO;
+}
+
 SdBusError::SdBusError(int error, const char* prefix, SdBusInterface* intf) :
     error(SD_BUS_ERROR_NULL), intf(intf)
 {