diff --git a/pkg/storage/fs/cback/cback.go b/pkg/storage/fs/cback/cback.go index 7b21db5b9a..8730256f20 100644 --- a/pkg/storage/fs/cback/cback.go +++ b/pkg/storage/fs/cback/cback.go @@ -331,8 +331,7 @@ func (fs *cback) Download(ctx context.Context, ref *provider.Reference) (io.Read } - err = errors.New("not found") - return nil, err + return nil, errtypes.NotFound("cback: resource not found") } func (fs *cback) GetHome(ctx context.Context) (string, error) { diff --git a/pkg/storage/fs/cback/utilities.go b/pkg/storage/fs/cback/utilities.go index 160eac82b0..750bedd423 100644 --- a/pkg/storage/fs/cback/utilities.go +++ b/pkg/storage/fs/cback/utilities.go @@ -10,6 +10,7 @@ import ( "time" provider "github.com/cs3org/go-cs3apis/cs3/storage/provider/v1beta1" + "github.com/cs3org/reva/pkg/errtypes" ) type backUpResponse struct { @@ -110,18 +111,15 @@ func (fs *cback) getRequest(userName, url string, reqType string) (io.ReadCloser } if resp.StatusCode == 404 { - err = errors.New("not found") - return nil, err + return nil, errtypes.NotFound("cback: resource not found") } if resp.StatusCode == 500 { - err = errors.New("invalid query") - return nil, err + return nil, errtypes.InternalError("cback: internal server error") } if resp.StatusCode == 403 { - err = errors.New("no permissions to get backup") - return nil, err + return nil, errtypes.PermissionDenied("cback: user has no permissions to get the backup") } return resp.Body, nil @@ -317,8 +315,7 @@ func (fs *cback) pathFinder(userName, path string) ([]string, error) { return returnString, nil } - err = errors.New("no match found") - return nil, err + return nil, errtypes.NotFound("cback: resource not found") }