From 64b83e364fe199191d3e98d60919e06de67c0a00 Mon Sep 17 00:00:00 2001 From: Max Schmitt Date: Thu, 18 Oct 2018 22:10:56 +0200 Subject: [PATCH] throw error when credentials are needed. --- pkg/fritzboxmetrics/fritzboxmetrics.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/pkg/fritzboxmetrics/fritzboxmetrics.go b/pkg/fritzboxmetrics/fritzboxmetrics.go index 4775f82..f5ca829 100644 --- a/pkg/fritzboxmetrics/fritzboxmetrics.go +++ b/pkg/fritzboxmetrics/fritzboxmetrics.go @@ -241,6 +241,9 @@ func (a *Action) Call() (Result, error) { if err != nil { return nil, errors.Wrap(err, "could not roundtrip digest authentification") } + if resp.StatusCode == http.StatusUnauthorized { + return nil, errors.New("authorization required") + } data := new(bytes.Buffer) data.ReadFrom(resp.Body)