Catch exceptions as a reference in ahci::start/end_measurement.

Signed-off-by: Sergey Senozhatsky <sergey.senozhat...@gmail.com>

---

diff --git a/devices/ahci.cpp b/devices/ahci.cpp
index d505642..3ca52f2 100644
--- a/devices/ahci.cpp
+++ b/devices/ahci.cpp
@@ -168,7 +168,8 @@ void ahci::start_measurement(void)
                                file >> start_slumber;
                }       
                file.close();
-       } catch (std::ios_base::failure c) {
+       } catch (std::ios_base::failure &c) {
+               fprintf(stderr, "%s\n", c.what());
        }
 
 }
@@ -199,7 +200,8 @@ void ahci::end_measurement(void)
                        file >> end_slumber;
                }
                file.close();
-       } catch (std::ios_base::failure c) {
+       } catch (std::ios_base::failure &c) {
+               fprintf(stderr, "%s\n", c.what());
        }
 
        if (end_active < start_active)
@@ -293,4 +295,5 @@ double ahci::power_usage(struct result_bundle *result, 
struct parameter_bundle *
        power += util * factor / 100.0;
 
        return power;
-}
\ No newline at end of file
+}
+

_______________________________________________
Discuss mailing list
Discuss@lesswatts.org
http://lists.lesswatts.org/listinfo/discuss

Reply via email to