chore: move errors
This commit is contained in:
@ -1,9 +0,0 @@
|
||||
package fs
|
||||
|
||||
import "errors"
|
||||
|
||||
var (
|
||||
ErrMoveBetweenTwoAccounts = errors.New("can't move files between two account, try to copy")
|
||||
ErrUploadNotSupported = errors.New("upload not supported")
|
||||
ErrNotFolder = errors.New("not a folder")
|
||||
)
|
@ -4,6 +4,7 @@ import (
|
||||
"context"
|
||||
"fmt"
|
||||
"github.com/alist-org/alist/v3/internal/driver"
|
||||
"github.com/alist-org/alist/v3/internal/errs"
|
||||
"github.com/alist-org/alist/v3/internal/model"
|
||||
"github.com/alist-org/alist/v3/internal/operations"
|
||||
"github.com/alist-org/alist/v3/pkg/task"
|
||||
@ -19,7 +20,7 @@ var UploadTaskManager = task.NewTaskManager[uint64](3, func(tid *uint64) {
|
||||
func Put(ctx context.Context, account driver.Driver, dstDirPath string, file model.FileStreamer) error {
|
||||
account, dstDirActualPath, err := operations.GetAccountAndActualPath(dstDirPath)
|
||||
if account.Config().NoUpload {
|
||||
return errors.WithStack(ErrUploadNotSupported)
|
||||
return errors.WithStack(errs.ErrUploadNotSupported)
|
||||
}
|
||||
if err != nil {
|
||||
return errors.WithMessage(err, "failed get account")
|
||||
|
@ -3,6 +3,7 @@ package fs
|
||||
import (
|
||||
"context"
|
||||
"github.com/alist-org/alist/v3/internal/driver"
|
||||
"github.com/alist-org/alist/v3/internal/errs"
|
||||
"github.com/alist-org/alist/v3/internal/operations"
|
||||
"github.com/pkg/errors"
|
||||
)
|
||||
@ -25,7 +26,7 @@ func Move(ctx context.Context, account driver.Driver, srcPath, dstDirPath string
|
||||
return errors.WithMessage(err, "failed get dst account")
|
||||
}
|
||||
if srcAccount.GetAccount() != dstAccount.GetAccount() {
|
||||
return errors.WithStack(ErrMoveBetweenTwoAccounts)
|
||||
return errors.WithStack(errs.ErrMoveBetweenTwoAccounts)
|
||||
}
|
||||
return operations.Move(ctx, account, srcActualPath, dstDirActualPath)
|
||||
}
|
||||
|
Reference in New Issue
Block a user