Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
dcdb
dcdb
Commits
05a1b44b
Commit
05a1b44b
authored
Apr 09, 2020
by
Michael Ott
Browse files
Re-throw exceptions from IPMIHost correctly
parent
07345740
Changes
1
Hide whitespace changes
Inline
Side-by-side
dcdbpusher/sensors/ipmi/LenovoXCC.cpp
View file @
05a1b44b
...
...
@@ -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
)){
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment