diff --git a/sensorhandler.cpp b/sensorhandler.cpp
index eb45900..c8d6d94 100644
--- a/sensorhandler.cpp
+++ b/sensorhandler.cpp
@@ -1179,7 +1179,7 @@
     fru = frus.find(fruID);
     if (fru == frus.end())
     {
-        return IPMI_CC_SENSOR_INVALID;
+        return ipmi::ccSensorInvalid;
     }
 
     /* Header */
@@ -1239,7 +1239,7 @@
     // Check for invalid offset size
     if (req->offset > sizeof(record))
     {
-        return IPMI_CC_PARM_OUT_OF_RANGE;
+        return ipmi::ccParmOutOfRange;
     }
 
     dataLength = std::min(static_cast<size_t>(req->bytes_to_read),
@@ -1273,7 +1273,7 @@
     entity = entityRecords.find(entityRecordID);
     if (entity == entityRecords.end())
     {
-        return IPMI_CC_SENSOR_INVALID;
+        return ipmi::ccSensorInvalid;
     }
 
     /* Header */
@@ -1312,7 +1312,7 @@
     // Check for invalid offset size
     if (req->offset > sizeof(record))
     {
-        return IPMI_CC_PARM_OUT_OF_RANGE;
+        return ipmi::ccParmOutOfRange;
     }
 
     dataLength = std::min(static_cast<size_t>(req->bytes_to_read),
@@ -1362,7 +1362,7 @@
             sensor = ipmi::sensor::sensors.find(recordID);
             if (sensor == ipmi::sensor::sensors.end())
             {
-                return IPMI_CC_SENSOR_INVALID;
+                return ipmi::ccSensorInvalid;
             }
         }
     }
@@ -1418,7 +1418,7 @@
 
     if (req->offset > sizeof(record))
     {
-        return IPMI_CC_PARM_OUT_OF_RANGE;
+        return ipmi::ccParmOutOfRange;
     }
 
     // data_len will ultimately be the size of the record, plus
@@ -1460,7 +1460,7 @@
     if ((paraLen < selSystemEventSizeWith1Bytes) ||
         (paraLen > selSystemEventSizeWith3Bytes))
     {
-        return IPMI_CC_REQ_DATA_LEN_INVALID;
+        return ipmi::ccReqDataLenInvalid;
     }
 
     if (isFromSystemChannel())
@@ -1488,7 +1488,7 @@
         ((req->data[0] & byte2EnableMask) != 0 &&
          paraLen < selSystemEventSizeWith2Bytes))
     {
-        return IPMI_CC_REQ_DATA_LEN_INVALID;
+        return ipmi::ccReqDataLenInvalid;
     }
 
     // Count bytes of Event Data
@@ -1521,7 +1521,7 @@
     catch (const sdbusplus::exception_t& e)
     {
         lg2::error("exception message: {ERROR}", "ERROR", e);
-        return IPMI_CC_UNSPECIFIED_ERROR;
+        return ipmi::ccUnspecifiedError;
     }
     return ipmi::ccSuccess;
 }
