Skip to content
This repository was archived by the owner on Aug 22, 2020. It is now read-only.

As a first step towards line-based manifest file deprecation, stop returning line-based parsing errors #26

Merged
merged 1 commit into from
Aug 19, 2020
Merged
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
5 changes: 3 additions & 2 deletions manifest/parse.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package manifest

import (
"bytes"
"fmt"
"io"
)

Expand All @@ -15,7 +14,9 @@ func Parse(reader io.Reader) (*Manifest2822, error) {
if err2822 != nil {
manifest, err := ParseLineBased(buf)
if err != nil {
return nil, fmt.Errorf("cannot parse manifest in either format:\nRFC 2822 error: %v\nLine-based error: %v", err2822, err)
// if we fail parsing line-based, eat the error and return the 2822 parsing error instead
// https://github.com/docker-library/bashbrew/issues/16
return nil, err2822
}
return manifest, nil
}
Expand Down
2 changes: 1 addition & 1 deletion manifest/parse_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ func TestParseError(t *testing.T) {
if err == nil {
t.Errorf("Expected error, got valid manifest instead:\n%s", man)
}
if !strings.HasPrefix(err.Error(), "cannot parse manifest in either format:") {
if !strings.HasPrefix(err.Error(), "Bad line:") {
t.Errorf("Unexpected error: %v", err)
}
}