Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion gcsfs/errors.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,15 @@ package gcsfs
import (
"errors"
"syscall"

"cloud.google.com/go/storage"
)

var (
ErrNoBucketInName = errors.New("no bucket name found in the name")
ErrFileClosed = errors.New("file is closed")
ErrOutOfRange = errors.New("out of range")
ErrObjectDoesNotExist = errors.New("storage: object doesn't exist")
Comment thread
ahkui marked this conversation as resolved.
ErrObjectDoesNotExist = storage.ErrObjectNotExist
ErrEmptyObjectName = errors.New("storage: object name is empty")
ErrFileNotFound = syscall.ENOENT
)
3 changes: 2 additions & 1 deletion gcsfs/file_info.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
package gcsfs

import (
"errors"
"os"
"path/filepath"
"strings"
Expand Down Expand Up @@ -58,7 +59,7 @@ func newFileInfo(name string, fs *Fs, fileMode os.FileMode) (*FileInfo, error) {
res.name = fs.ensureTrailingSeparator(res.name)
res.isDir = true
return res, nil
} else if err.Error() == ErrObjectDoesNotExist.Error() {
} else if errors.Is(err, ErrObjectDoesNotExist) {
// Folders do not actually "exist" in GCloud, so we have to check, if something exists with
// such a prefix
bucketName, bucketPath := fs.splitName(name)
Expand Down
2 changes: 1 addition & 1 deletion gcsfs/gcs_mocks.go
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ func (o *objectMock) Attrs(_ context.Context) (*storage.ObjectAttrs, error) {

if info.IsDir() {
// we have to mock it here, because of FileInfo logic
return nil, ErrObjectDoesNotExist
return nil, storage.ErrObjectNotExist
}

return res, nil
Expand Down