Common practive for exceptions is to 'throw by value, catch by reference'.

Signed-off-by: Sergey Senozhatsky <[email protected]>

---

 src/devices/ahci.cpp |    6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/devices/ahci.cpp b/src/devices/ahci.cpp
index 1d2c252..26f83a3 100644
--- a/src/devices/ahci.cpp
+++ b/src/devices/ahci.cpp
@@ -170,7 +170,8 @@ void ahci::start_measurement(void)
                file.close();
        }
 #ifndef DISABLE_TRYCATCH
-       catch (std::ios_base::failure c) {
+       catch (std::ios_base::failure &c) {
+               fprintf(stderr, "%s\n", c.what());
        }
 #endif
 
@@ -204,7 +205,8 @@ void ahci::end_measurement(void)
                file.close();
        }
 #ifndef DISABLE_TRYCATCH
-       catch (std::ios_base::failure c) {
+       catch (std::ios_base::failure &c) {
+               fprintf(stderr, "%s\n", c.what());
        }
 #endif
        if (end_active < start_active)

_______________________________________________
Power mailing list
[email protected]
https://bughost.org/mailman/listinfo/power

Reply via email to