From c50dd16d82d88c109010becba10ae35af9f00f1d Mon Sep 17 00:00:00 2001 From: Jon Trulson Date: Tue, 8 Sep 2015 17:09:22 -0600 Subject: [PATCH] rfr359f: throw exception(s) on fatal errors Signed-off-by: Jon Trulson Signed-off-by: Mihai Tudor Panu --- src/rfr359f/rfr359f.cxx | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/rfr359f/rfr359f.cxx b/src/rfr359f/rfr359f.cxx index f628871a..96dfc22f 100644 --- a/src/rfr359f/rfr359f.cxx +++ b/src/rfr359f/rfr359f.cxx @@ -23,6 +23,8 @@ */ #include +#include +#include #include "rfr359f.h" @@ -33,7 +35,8 @@ RFR359F::RFR359F(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; }