mirror of
https://github.com/go-gitea/gitea
synced 2024-11-09 08:07:10 +01:00
fix: ErrObjectNotExist
This commit is contained in:
parent
ee997bb004
commit
7ebf151258
@ -7,6 +7,8 @@ import (
|
|||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
"code.gitea.io/gitea/modules/util"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
@ -74,7 +76,7 @@ var (
|
|||||||
// 410 - The object was removed by the owner.
|
// 410 - The object was removed by the owner.
|
||||||
// 422 - Validation error.
|
// 422 - Validation error.
|
||||||
|
|
||||||
ErrObjectNotFound = errors.New("the object does not exist on the server")
|
ErrObjectNotExist = util.ErrNotExist // the object does not exist on the server
|
||||||
ErrObjectHashMismatch = errors.New("the specified hash algorithm disagrees with the server's acceptable options")
|
ErrObjectHashMismatch = errors.New("the specified hash algorithm disagrees with the server's acceptable options")
|
||||||
ErrObjectRemoved = errors.New("the object was removed by the owner")
|
ErrObjectRemoved = errors.New("the object was removed by the owner")
|
||||||
ErrObjectValidation = errors.New("validation error")
|
ErrObjectValidation = errors.New("validation error")
|
||||||
@ -87,7 +89,7 @@ func (e *ObjectError) Error() string {
|
|||||||
func (e *ObjectError) Unwrap() error {
|
func (e *ObjectError) Unwrap() error {
|
||||||
switch e.Code {
|
switch e.Code {
|
||||||
case 404:
|
case 404:
|
||||||
return ErrObjectNotFound
|
return ErrObjectNotExist
|
||||||
case 409:
|
case 409:
|
||||||
return ErrObjectHashMismatch
|
return ErrObjectHashMismatch
|
||||||
case 410:
|
case 410:
|
||||||
|
@ -182,7 +182,7 @@ func StoreMissingLfsObjectsInRepository(ctx context.Context, repo *repo_model.Re
|
|||||||
downloadObjects := func(pointers []lfs.Pointer) error {
|
downloadObjects := func(pointers []lfs.Pointer) error {
|
||||||
err := lfsClient.Download(ctx, pointers, func(p lfs.Pointer, content io.ReadCloser, objectError error) error {
|
err := lfsClient.Download(ctx, pointers, func(p lfs.Pointer, content io.ReadCloser, objectError error) error {
|
||||||
if objectError != nil {
|
if objectError != nil {
|
||||||
if errors.Is(objectError, lfs.ErrObjectNotFound) {
|
if errors.Is(objectError, lfs.ErrObjectNotExist) {
|
||||||
log.Warn("Repo[%-v]: Ignore missing LFS object %-v: %v", repo, p, objectError)
|
log.Warn("Repo[%-v]: Ignore missing LFS object %-v: %v", repo, p, objectError)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user