diff --git a/src/mpu9150/mpu9150.cxx b/src/mpu9150/mpu9150.cxx index e8961655..a4463a9c 100644 --- a/src/mpu9150/mpu9150.cxx +++ b/src/mpu9150/mpu9150.cxx @@ -49,7 +49,8 @@ bool MPU9150::init() // init the gyro/accel component if (!MPU60X0::init()) { - cerr << __FUNCTION__ << ": Unable to init MPU60X0" << endl; + throw std::runtime_error(std::string(__FUNCTION__) + + ": Unable to init MPU60X0"); return false; } @@ -57,7 +58,8 @@ bool MPU9150::init() // will allow us to access the AK8975 Magnetometer on I2C addr 0x0c. if (!enableI2CBypass(true)) { - cerr << __FUNCTION__ << ": Unable to enable I2C bypass" << endl; + throw std::runtime_error(std::string(__FUNCTION__) + + ": Unable to enable I2C bypass"); return false; } @@ -67,7 +69,8 @@ bool MPU9150::init() if (!m_mag->init()) { - cerr << __FUNCTION__ << ": Unable to init magnetometer" << endl; + throw std::runtime_error(std::string(__FUNCTION__) + + ": Unable to init magnetometer"); delete m_mag; m_mag = 0; return false;