Skip to content
Open
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: 2 additions & 2 deletions faults.go
Original file line number Diff line number Diff line change
Expand Up @@ -491,7 +491,7 @@ type MissingFailure struct {
}

func (e *MissingFailure) Error() string {
return "resource not found"
return maybeWrap(e.error, "resource not found").Error()
}

func (e *MissingFailure) Is(target error) bool {
Expand All @@ -508,7 +508,7 @@ type PermissionFailure struct {
}

func (e *PermissionFailure) Error() string {
return "permission denied"
return maybeWrap(e.error, "permission denied").Error()
}

func (e *PermissionFailure) Is(target error) bool {
Expand Down
10 changes: 10 additions & 0 deletions faults_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -508,6 +508,16 @@ func TestErrorMessage(t *testing.T) {
err: faults.WithResourceExhausted(cause),
wantMsg: "quota failure: underlying issue",
},
{
scenario: "WithNotFound wrapping a cause includes the cause in the message",
err: faults.WithNotFound(cause),
wantMsg: "resource not found: underlying issue",
},
{
scenario: "WithPermissionDenied wrapping a cause includes the cause in the message",
err: faults.WithPermissionDenied(cause),
wantMsg: "permission denied: underlying issue",
},
}

for _, tt := range tests {
Expand Down
Loading