VOL-2631 Update to voltha-lib-go 3.0.14
Change-Id: I21ef41d49ad6bd42ad301962583d2aabdea7ccad
diff --git a/vendor/github.com/opencord/voltha-lib-go/v3/pkg/adapters/common/core_proxy.go b/vendor/github.com/opencord/voltha-lib-go/v3/pkg/adapters/common/core_proxy.go
index 1882135..86f186d 100644
--- a/vendor/github.com/opencord/voltha-lib-go/v3/pkg/adapters/common/core_proxy.go
+++ b/vendor/github.com/opencord/voltha-lib-go/v3/pkg/adapters/common/core_proxy.go
@@ -284,7 +284,7 @@
volthaDevice := &voltha.Device{}
if err := ptypes.UnmarshalAny(result, volthaDevice); err != nil {
logger.Warnw("cannot-unmarshal-response", log.Fields{"error": err})
- return nil, status.Errorf(codes.InvalidArgument, "%s", err.Error())
+ return nil, status.Error(codes.InvalidArgument, err.Error())
}
return volthaDevice, nil
} else {
@@ -294,8 +294,8 @@
logger.Warnw("cannot-unmarshal-response", log.Fields{"error": err})
}
logger.Debugw("ChildDeviceDetected-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)
+
+ return nil, status.Error(ICProxyErrorCodeToGrpcErrorCode(unpackResult.Code), unpackResult.Reason)
}
}
@@ -361,7 +361,7 @@
volthaDevice := &voltha.Device{}
if err := ptypes.UnmarshalAny(result, volthaDevice); err != nil {
logger.Warnw("cannot-unmarshal-response", log.Fields{"error": err})
- return nil, status.Errorf(codes.InvalidArgument, "%s", err.Error())
+ return nil, status.Error(codes.InvalidArgument, err.Error())
}
return volthaDevice, nil
} else {
@@ -372,7 +372,7 @@
}
logger.Debugw("GetDevice-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)
+ return nil, status.Error(ICProxyErrorCodeToGrpcErrorCode(unpackResult.Code), unpackResult.Reason)
}
}
@@ -421,7 +421,7 @@
volthaDevice := &voltha.Device{}
if err := ptypes.UnmarshalAny(result, volthaDevice); err != nil {
logger.Warnw("cannot-unmarshal-response", log.Fields{"error": err})
- return nil, status.Errorf(codes.InvalidArgument, "%s", err.Error())
+ return nil, status.Error(codes.InvalidArgument, err.Error())
}
return volthaDevice, nil
} else {
@@ -432,13 +432,7 @@
}
logger.Debugw("GetChildDevice-return", log.Fields{"deviceid": parentDeviceId, "success": success, "error": err})
- code := codes.Internal
-
- if unpackResult.Code == ic.ErrorCode_DEADLINE_EXCEEDED {
- code = codes.DeadlineExceeded
- }
-
- return nil, status.Errorf(code, "%s", unpackResult.Reason)
+ return nil, status.Error(ICProxyErrorCodeToGrpcErrorCode(unpackResult.Code), unpackResult.Reason)
}
}
@@ -463,7 +457,7 @@
volthaDevices := &voltha.Devices{}
if err := ptypes.UnmarshalAny(result, volthaDevices); err != nil {
logger.Warnw("cannot-unmarshal-response", log.Fields{"error": err})
- return nil, status.Errorf(codes.InvalidArgument, "%s", err.Error())
+ return nil, status.Error(codes.InvalidArgument, err.Error())
}
return volthaDevices, nil
} else {
@@ -474,13 +468,7 @@
}
logger.Debugw("GetChildDevices-return", log.Fields{"deviceid": parentDeviceId, "success": success, "error": err})
- code := codes.Internal
-
- if unpackResult.Code == ic.ErrorCode_DEADLINE_EXCEEDED {
- code = codes.DeadlineExceeded
- }
-
- return nil, status.Errorf(code, "%s", unpackResult.Reason)
+ return nil, status.Error(ICProxyErrorCodeToGrpcErrorCode(unpackResult.Code), unpackResult.Reason)
}
}