Skip to content

Commit 42232c2

Browse files
committed
Better error message
1 parent 6e324dd commit 42232c2

File tree

2 files changed

+3
-4
lines changed

2 files changed

+3
-4
lines changed

extract_test.go

+2-3
Original file line numberDiff line numberDiff line change
@@ -181,9 +181,8 @@ var ExtractCases = []struct {
181181

182182
func TestArchiveFailure(t *testing.T) {
183183
err := extract.Archive(context.Background(), strings.NewReader("not an archive"), "", nil)
184-
if err == nil || err.Error() != "Not a supported archive" {
185-
t.Error("Expected error 'Not a supported archive', got", err)
186-
}
184+
require.Error(t, err)
185+
require.Contains(t, err.Error(), "Not a supported archive")
187186
}
188187

189188
func TestExtract(t *testing.T) {

extractor.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ func (e *Extractor) Archive(ctx context.Context, body io.Reader, location string
5555
case "tar":
5656
return e.Tar(ctx, body, location, rename)
5757
default:
58-
return errors.New("Not a supported archive")
58+
return errors.New("Not a supported archive: " + kind.Extension)
5959
}
6060
}
6161

0 commit comments

Comments
 (0)