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

@@ -11,9 +11,9 @@ func TestFilesystem_PathResolutionError(t *testing.T) {
g.Describe("NewBadPathResolutionError", func() {
g.It("is can detect itself as an error correctly", func() {
err := NewBadPathResolution("foo", "bar")
g.Assert(IsBadPathResolutionError(err)).IsTrue()
g.Assert(IsErrorCode(err, ErrCodePathResolution)).IsTrue()
g.Assert(err.Error()).Equal("filesystem: server path [foo] resolves to a location outside the server root: bar")
g.Assert(IsBadPathResolutionError(ErrIsDirectory)).IsFalse()
g.Assert(IsErrorCode(&Error{code: ErrCodeIsDirectory}, ErrCodePathResolution)).IsFalse()
})
g.It("returns <empty> if no destination path is provided", func() {