psusensor: add error handling for all err code

In psusensor handleResponse check for all non 0 error code and read
bytes equal 0, skip parse read data and start waitTimer to try again.
Without this change, sometimes psusensor would log a read error when
power state is off and the sensor requires power state to be on, which
is non desirable.

Tested:
No more read error message in the journal log when system power state
is off.

Signed-off-by: Zhikui Ren <zhikui.ren@intel.com>
Change-Id: I228de0d454862335ccaa42c1fb12efc08da55084
diff --git a/src/PSUSensor.cpp b/src/PSUSensor.cpp
index ecf546e..d1859c1 100644
--- a/src/PSUSensor.cpp
+++ b/src/PSUSensor.cpp
@@ -203,6 +203,16 @@
         std::cerr << "Bad file descriptor for " << path << "\n";
         return;
     }
+    if (err || bytesRead == 0)
+    {
+        if (readingStateGood())
+        {
+            std::cerr << name << " read failed\n";
+        }
+        restartRead();
+        return;
+    }
+
     // null terminate the string so we don't walk off the end
     std::array<char, 128>& bufferRef = *buffer;
     bufferRef[bytesRead] = '\0';