Convert all filesystem error types into the same Error struct

This commit is contained in:
Dane Everitt
2020-12-15 20:51:13 -08:00
parent 9ae75a399b
commit 3a26a5d39d
11 changed files with 104 additions and 75 deletions

View File

@@ -171,7 +171,7 @@ func (fs *Filesystem) DirectorySize(dir string) (int64, error) {
// it. Otherwise, allow it to continue.
if e.IsSymlink() {
if _, err := fs.SafePath(p); err != nil {
if IsBadPathResolutionError(err) {
if IsErrorCode(err, ErrCodePathResolution) {
return godirwalk.SkipThis
}
@@ -205,7 +205,7 @@ func (fs *Filesystem) hasSpaceFor(size int64) error {
}
if (s + size) > fs.MaxDisk() {
return ErrNotEnoughDiskSpace
return &Error{code: ErrCodeDiskSpace}
}
return nil