[VOL-2364] InvokeRPC returns an error code in case of a timeout

Change-Id: Ia3725bb4778e1935cf62e5348bfcd0bd15cb9466
diff --git a/pkg/adapters/common/core_proxy.go b/pkg/adapters/common/core_proxy.go
index cf80858..c5e1c14 100644
--- a/pkg/adapters/common/core_proxy.go
+++ b/pkg/adapters/common/core_proxy.go
@@ -431,8 +431,14 @@
 			logger.Warnw("cannot-unmarshal-response", log.Fields{"error": err})
 		}
 		logger.Debugw("GetChildDevice-return", log.Fields{"deviceid": parentDeviceId, "success": success, "error": err})
-		// TODO:  Need to get the real error code
-		return nil, status.Errorf(codes.Internal, "%s", unpackResult.Reason)
+
+		code := codes.Internal
+
+		if unpackResult.Code == ic.ErrorCode_DEADLINE_EXCEEDED {
+			code = codes.DeadlineExceeded
+		}
+
+		return nil, status.Errorf(code, "%s", unpackResult.Reason)
 	}
 }
 
@@ -467,8 +473,14 @@
 			logger.Warnw("cannot-unmarshal-response", log.Fields{"error": err})
 		}
 		logger.Debugw("GetChildDevices-return", log.Fields{"deviceid": parentDeviceId, "success": success, "error": err})
-		// TODO:  Need to get the real error code
-		return nil, status.Errorf(codes.Internal, "%s", unpackResult.Reason)
+
+		code := codes.Internal
+
+		if unpackResult.Code == ic.ErrorCode_DEADLINE_EXCEEDED {
+			code = codes.DeadlineExceeded
+		}
+
+		return nil, status.Errorf(code, "%s", unpackResult.Reason)
 	}
 }