Commit 05a1b44b authored by Michael Ott's avatar Michael Ott

Re-throw exceptions from IPMIHost correctly

parent 07345740
......@@ -75,9 +75,8 @@ int LenovoXCC::getBulkPower(std::vector<reading_t> &readings) {
try {
len = _host->sendRawCmd(getBulkCmd, sizeof(getBulkCmd), buf, sizeof(buf));
} catch (const std::exception &e) {
throw e;
return 1;
} catch (...) {
throw;
}
if ((len == 208) && (buf[0] == 0x32) && (buf[1] == 0x00)) {
......@@ -104,9 +103,8 @@ int LenovoXCC::getBulkEnergy(std::vector<reading_t> &readings) {
int len = -1;
try {
len = _host->sendRawCmd(getBulkCmd, sizeof(getBulkCmd), buf, sizeof(buf));
} catch (const std::exception &e) {
throw e;
return 1;
} catch (...) {
throw;
}
if ((len == 212) && (buf[0] == 0x32) && (buf[1] == 0x00)) {
......@@ -151,9 +149,8 @@ int LenovoXCC::readSingleEnergyRaw(uint64_t &timeStamp, uint64_t &energy) {
int len = -1;
try {
len = _host->sendRawCmd(getSingleEnergyCmd, sizeof(getSingleEnergyCmd), buf, sizeof(buf));
} catch (const std::exception &e) {
throw e;
return 1;
} catch (...) {
throw;
}
if ((len == 16) && (buf[0] == 0x32) && (buf[1] == 0x00)) {
......@@ -183,9 +180,8 @@ int LenovoXCC::openDatastore() {
int len = -1;
try {
len = _host->sendRawCmd(getHandleCmd, sizeof(getHandleCmd), buf, sizeof(buf));
} catch (const std::exception &e) {
throw e;
return 255;
} catch (...) {
throw;
}
if ((len == 9) && (buf[0] == 0x90) && (buf[1] == 0x00)) {
......@@ -208,9 +204,8 @@ int LenovoXCC::closeDatastore() {
int len = -1;
try {
len = _host->sendRawCmd(closeHandleCmd, sizeof(closeHandleCmd), buf, sizeof(buf));
} catch (const std::exception &e) {
throw e;
return 255;
} catch (...) {
throw;
}
if ((len == 5) && (buf[0] == 0x90) && (buf[1] == 0x00)) {
......@@ -229,9 +224,8 @@ int LenovoXCC::readDatastoreRange(uint32_t offset, uint16_t count, uint8_t *buf,
int len = -1;
try {
len = _host->sendRawCmd(getDataCmd, sizeof(getDataCmd), buf, bufLen);
} catch (const std::exception &e) {
throw e;
return -1;
} catch (...) {
throw;
}
if ((len >= 2) && (buf[0] == 0x90) && (buf[1] == 0x00)) {
......@@ -246,9 +240,8 @@ uint64_t LenovoXCC::readDatastoreTimestamp() {
int len = -1;
try {
len = readDatastoreRange(0, 16, buf, sizeof(buf));
} catch (const std::exception &e) {
throw e;
return 0;
} catch (...) {
throw;
}
if ((len == 23) && (buf[0] == 0x90) && (buf[1] == 0x00)){
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment