pkg/jsonmessage: JSONMessage.Display(): remove special case for 401 errors
This special case was added in3043c26419
as a sentinel error (`AuthRequiredError`) to check whether authentication is required (and to prompt the users to authenticate). A later refactor (946bbee39a
) removed the `AuthRequiredError`, but kept the error-message and logic. Starting withfcee6056dc
, it looks like we no longer depend on this specific error, so we can return the registry's error message instead. Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
parent
2adec6c8c0
commit
4cadee65b3
2 changed files with 1 additions and 4 deletions
|
@ -168,9 +168,6 @@ func cursorDown(out io.Writer, l uint) {
|
|||
// entire current line when displaying the progressbar.
|
||||
func (jm *JSONMessage) Display(out io.Writer, isTerminal bool) error {
|
||||
if jm.Error != nil {
|
||||
if jm.Error.Code == 401 {
|
||||
return fmt.Errorf("authentication is required")
|
||||
}
|
||||
return jm.Error
|
||||
}
|
||||
var endl string
|
||||
|
|
|
@ -216,7 +216,7 @@ func TestJSONMessageDisplayWithJSONError(t *testing.T) {
|
|||
|
||||
jsonMessage = JSONMessage{Error: &JSONError{401, "Anything"}}
|
||||
err = jsonMessage.Display(data, true)
|
||||
assert.Check(t, is.Error(err, "authentication is required"))
|
||||
assert.Check(t, is.Error(err, "Anything"))
|
||||
}
|
||||
|
||||
func TestDisplayJSONMessagesStreamInvalidJSON(t *testing.T) {
|
||||
|
|
Loading…
Reference in a new issue