Skip to content

Commit f359152

Browse files
authored
Merge pull request #26 from infosiftr/line-based-errors
As a first step towards line-based manifest file deprecation, stop returning line-based parsing errors
2 parents c5db18c + 718495e commit f359152

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

manifest/parse.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ package manifest
22

33
import (
44
"bytes"
5-
"fmt"
65
"io"
76
)
87

@@ -15,7 +14,9 @@ func Parse(reader io.Reader) (*Manifest2822, error) {
1514
if err2822 != nil {
1615
manifest, err := ParseLineBased(buf)
1716
if err != nil {
18-
return nil, fmt.Errorf("cannot parse manifest in either format:\nRFC 2822 error: %v\nLine-based error: %v", err2822, err)
17+
// if we fail parsing line-based, eat the error and return the 2822 parsing error instead
18+
// https://github.com/docker-library/bashbrew/issues/16
19+
return nil, err2822
1920
}
2021
return manifest, nil
2122
}

manifest/parse_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ func TestParseError(t *testing.T) {
1414
if err == nil {
1515
t.Errorf("Expected error, got valid manifest instead:\n%s", man)
1616
}
17-
if !strings.HasPrefix(err.Error(), "cannot parse manifest in either format:") {
17+
if !strings.HasPrefix(err.Error(), "Bad line:") {
1818
t.Errorf("Unexpected error: %v", err)
1919
}
2020
}

0 commit comments

Comments
 (0)