From dc49f36e83fe78125708afe478ecc996bcd87ac5 Mon Sep 17 00:00:00 2001 From: Jon Trulson Date: Tue, 8 Sep 2015 16:12:31 -0600 Subject: [PATCH] guvas12d: throw exception(s) on fatal errors Signed-off-by: Jon Trulson Signed-off-by: Mihai Tudor Panu --- src/guvas12d/guvas12d.cxx | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/guvas12d/guvas12d.cxx b/src/guvas12d/guvas12d.cxx index 90a65413..7b30e1f3 100644 --- a/src/guvas12d/guvas12d.cxx +++ b/src/guvas12d/guvas12d.cxx @@ -23,6 +23,8 @@ */ #include +#include +#include #include "guvas12d.h" @@ -33,7 +35,8 @@ GUVAS12D::GUVAS12D(int pin) { if ( !(m_aio = mraa_aio_init(pin)) ) { - cerr << __FUNCTION__ << ": mraa_aio_init() failed" << endl; + throw std::invalid_argument(std::string(__FUNCTION__) + + ": mraa_aio_init() failed, invalid pin?"); return; } }