vcom/internal/vfs/errors.go

36 lines
1.1 KiB
Go
Raw Normal View History

package vfs
import (
"context"
"errors"
"io/fs"
)
// Sentinel errors, checked with errors.Is. Implementations map their native
// errors (errno, SFTP status codes) onto these, so the UI and transfer never
// see *sftp.StatusError.
//
// ErrNotExist, ErrExist and ErrPermission are the io/fs sentinels and
// ErrUnsupported is errors.ErrUnsupported, so *os.PathError values from the
// local disk already match without wrapping. ErrCancelled is context.Canceled.
var (
ErrNotExist = fs.ErrNotExist
ErrExist = fs.ErrExist
ErrPermission = fs.ErrPermission
ErrUnsupported = errors.ErrUnsupported
ErrCancelled = context.Canceled
// ErrReadOnly: the FS (or the volume behind it) does not allow writes.
ErrReadOnly = errors.New("read-only file system")
// ErrConnLost: the connection died; the operation may be retried after
// a reconnect.
ErrConnLost = errors.New("connection lost")
)
// SkipDir and SkipAll are returned by a WalkFunc to skip a directory's
// contents or stop the walk without an error.
var (
SkipDir = fs.SkipDir
SkipAll = fs.SkipAll
)