Skip to content

Commit

Permalink
got a decent error
Browse files Browse the repository at this point in the history
  • Loading branch information
ItamarYuran committed Jan 2, 2025
1 parent cd5b80d commit 33ca670
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
5 changes: 3 additions & 2 deletions pkg/api/helpers/errors.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,9 @@ var (
ErrUnsupportedProtocol = errors.New("unsupported protocol")

// ErrRequestFailed is an error returned for failing lakeFS server replies.
ErrRequestFailed = errors.New("request failed")
ErrConflict = errors.New("conflict")
ErrRequestFailed = errors.New("request failed")
ErrConflict = errors.New("conflict")
ErrProtectedBranch = errors.New("writing to protected branch")
)

const minHTTPErrorStatusCode = 400
Expand Down
3 changes: 3 additions & 0 deletions pkg/api/helpers/upload.go
Original file line number Diff line number Diff line change
Expand Up @@ -386,6 +386,9 @@ func (u *presignUpload) uploadObject(ctx context.Context) (*apigen.ObjectStats,
if linkResp.JSON200 != nil {
return linkResp.JSON200, nil
}
if linkResp.JSON403 != nil {
return nil, fmt.Errorf("link object to backing store: %w (%s)", ErrProtectedBranch, linkResp.Status())
}
if linkResp.JSON409 != nil {
return nil, ErrConflict
}
Expand Down

0 comments on commit 33ca670

Please sign in to comment.