Return error correctly
@@ -56,14 +56,16 @@ func (nsem *nseManager) getEndpoint(ctx context.Context, requestConnection nsm.N
endpoints := filterEndpoints(endpointResponse.GetNetworkServiceEndpoints(), ignore_endpoints)
if len(endpoints) == 0 {
- return nil, fmt.Errorf("Failed to find NSE for NetworkService %s. Checked: %d of total NSEs: %d",
+ return nil, fmt.Errorf("failed to find NSE for NetworkService %s. Checked: %d of total NSEs: %d",
requestConnection.GetNetworkService(), len(ignore_endpoints), len(endpoints))
}
endpoint := nsem.model.GetSelector().SelectEndpoint(requestConnection.(*local_connection.Connection), endpointResponse.GetNetworkService(), endpoints)
if endpoint == nil {
- return nil, err
+ return nil, fmt.Errorf("failed to find NSE for NetworkService %s. Checked: %d of total NSEs: %d",
+ requestConnection.GetNetworkService(), len(ignore_endpoints), len(endpoints))
}
+
return &registry.NSERegistration{
NetworkServiceManager: endpointResponse.GetNetworkServiceManagers()[endpoint.GetNetworkServiceManagerName()],
NetworkserviceEndpoint: endpoint,
