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