Skip to content

Commit

Permalink
chore: Bring back the print error (#1451)
Browse files Browse the repository at this point in the history
Signed-off-by: Terry Howe <[email protected]>
  • Loading branch information
Terry Howe authored Jul 23, 2024
1 parent 18f496c commit 341ceb8
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion cmd/oras/internal/display/metadata/text/push_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ func TestPushHandler_OnCompleted(t *testing.T) {
Digest: digest.FromBytes(content),
Size: int64(len(content)),
},
false, // Printer ignores error
true,
},
}
for _, tt := range tests {
Expand Down
2 changes: 1 addition & 1 deletion cmd/oras/internal/output/print.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,8 @@ func (p *Printer) Println(a ...any) error {
if err != nil {
err = fmt.Errorf("display output error: %w", err)
_, _ = fmt.Fprint(p.err, err)
return err
}
// Errors are handled above, so return nil
return nil
}

Expand Down
4 changes: 2 additions & 2 deletions cmd/oras/internal/output/print_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@ func TestPrinter_Println(t *testing.T) {
if mockWriter.errorCount != 1 {
t.Error("Expected one error actual <" + strconv.Itoa(mockWriter.errorCount) + ">")
}
if err != nil {
t.Error("Expected error to be ignored")
if err == nil {
t.Error("Expected error got <nil>")
}
err = printer.Printf("boom")
if mockWriter.errorCount != 2 {
Expand Down

0 comments on commit 341ceb8

Please sign in to comment.