From c3297bcc5582116b219d2b688bfff8e7d90d0c87 Mon Sep 17 00:00:00 2001 From: Jon Trulson Date: Thu, 10 Sep 2015 10:58:07 -0600 Subject: [PATCH] groveemg: throw exception(s) on fatal errors Signed-off-by: Jon Trulson Signed-off-by: Mihai Tudor Panu --- src/groveemg/groveemg.cxx | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/groveemg/groveemg.cxx b/src/groveemg/groveemg.cxx index 7715efe0..17f3d251 100644 --- a/src/groveemg/groveemg.cxx +++ b/src/groveemg/groveemg.cxx @@ -23,6 +23,8 @@ */ #include +#include +#include #include "groveemg.h" @@ -33,7 +35,8 @@ GroveEMG::GroveEMG(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; } }