enhancement: add error origin information to the errorcode package

This commit is contained in:
Florian Schade
2024-06-19 15:57:35 +02:00
parent 1f012ac9b5
commit 3280b22ffe
12 changed files with 180 additions and 153 deletions
-23
View File
@@ -3,7 +3,6 @@ package command
import (
"context"
"errors"
"fmt"
"github.com/cs3org/reva/v2/pkg/events"
"github.com/cs3org/reva/v2/pkg/events/stream"
@@ -187,25 +186,3 @@ func updateShareRequest(shareID *collaboration.ShareId, uid *user.UserId) *colla
UpdateMask: &fieldmaskpb.FieldMask{Paths: []string{"state"}},
}
}
// getSharesList gets the list of all shares for the given user.
func getSharesList(ctx context.Context, gatewaySelector pool.Selectable[gateway.GatewayAPIClient], uid *user.UserId) (*collaboration.ListReceivedSharesResponse, error) {
gwc, err := gatewaySelector.Next()
if err != nil {
return nil, err
}
shares, err := gwc.ListReceivedShares(ctx, &collaboration.ListReceivedSharesRequest{
Opaque: utils.AppendJSONToOpaque(nil, "userid", uid),
})
if err != nil {
return nil, err
}
if shares.Status.Code != rpc.Code_CODE_OK {
if shares.Status.Code == rpc.Code_CODE_NOT_FOUND {
return nil, fmt.Errorf("not found")
}
return nil, fmt.Errorf(shares.GetStatus().GetMessage())
}
return shares, nil
}