Skip to content

Commit

Permalink
Fixed error messages due to copy/paste (too much boiler-plate coding?)
Browse files Browse the repository at this point in the history
  • Loading branch information
glpatcern committed Jul 30, 2020
1 parent 6069fc8 commit 344054c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 7 deletions.
4 changes: 2 additions & 2 deletions internal/grpc/services/gateway/appregistry.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ import (
func (s *svc) GetAppProviders(ctx context.Context, req *registry.GetAppProvidersRequest) (*registry.GetAppProvidersResponse, error) {
c, err := pool.GetAppRegistryClient(s.c.AppRegistryEndpoint)
if err != nil {
err = errors.Wrap(err, "gateway: error calling GetOCMShareProviderClient")
err = errors.Wrap(err, "gateway: error calling GetAppRegistryClient")
return &registry.GetAppProvidersResponse{
Status: status.NewInternal(ctx, err, "error getting user share provider client"),
}, nil
Expand All @@ -47,7 +47,7 @@ func (s *svc) GetAppProviders(ctx context.Context, req *registry.GetAppProviders
func (s *svc) ListAppProviders(ctx context.Context, req *registry.ListAppProvidersRequest) (*registry.ListAppProvidersResponse, error) {
c, err := pool.GetAppRegistryClient(s.c.AppRegistryEndpoint)
if err != nil {
err = errors.Wrap(err, "gateway: error calling GetOCMShareProviderClient")
err = errors.Wrap(err, "gateway: error calling GetAppRegistryClient")
return &registry.ListAppProvidersResponse{
Status: status.NewInternal(ctx, err, "error getting user share provider client"),
}, nil
Expand Down
7 changes: 2 additions & 5 deletions internal/grpc/services/gateway/usershareprovider.go
Original file line number Diff line number Diff line change
Expand Up @@ -367,15 +367,12 @@ func (s *svc) createReference(ctx context.Context, resourceID *provider.Resource

statRes, err := c.Stat(ctx, statReq)
if err != nil {
log.Err(err).Msg("gateway: error calling Stat for the share resource id:" + resourceID.String())
return &rpc.Status{
Code: rpc.Code_CODE_INTERNAL,
}, nil
return status.NewInternal(ctx, err, "gateway: error calling Stat for the share resource id: "+resourceID.String()), nil
}

if statRes.Status.Code != rpc.Code_CODE_OK {
err := status.NewErrorFromCode(statRes.Status.GetCode(), "gateway")
log.Err(err).Msg("gateway: error calling Stat for the share resource id:" + resourceID.String())
log.Err(err).Msg("gateway: Stat failed on the share resource id: " + resourceID.String())
return status.NewInternal(ctx, err, "error updating received share"), nil
}

Expand Down

0 comments on commit 344054c

Please sign in to comment.