Cleanup request error handling; properly handle os.ErrNotExist errors (#150)

This commit is contained in:
Dane Everitt
2022-11-22 10:18:27 -08:00
committed by GitHub
parent 9226ccae31
commit ff50d0e5bd
13 changed files with 236 additions and 341 deletions

View File

@@ -18,6 +18,7 @@ const (
ErrCodePathResolution ErrorCode = "E_BADPATH"
ErrCodeDenylistFile ErrorCode = "E_DENYLIST"
ErrCodeUnknownError ErrorCode = "E_UNKNOWN"
ErrNotExist ErrorCode = "E_NOTEXIST"
)
type Error struct {
@@ -68,6 +69,8 @@ func (e *Error) Error() string {
r = "<empty>"
}
return fmt.Sprintf("filesystem: server path [%s] resolves to a location outside the server root: %s", e.path, r)
case ErrNotExist:
return "filesystem: does not exist"
case ErrCodeUnknownError:
fallthrough
default: