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

@@ -62,7 +62,7 @@ func (fs *Filesystem) Readfile(p string, w io.Writer) error {
if st, err := os.Stat(cleaned); err != nil {
return err
} else if st.IsDir() {
return ErrIsDirectory
return &Error{code: ErrCodeIsDirectory}
}
f, err := os.Open(cleaned)
@@ -100,7 +100,7 @@ func (fs *Filesystem) Writefile(p string, r io.Reader) error {
}
} else {
if stat.IsDir() {
return ErrIsDirectory
return &Error{code: ErrCodeIsDirectory}
}
currentSize = stat.Size()