From 13b599a63459dbeb4a9e1fc9657f5a0c437f7e28 Mon Sep 17 00:00:00 2001 From: "Kaltenbach, Jonas" Date: Mon, 24 Oct 2022 10:44:34 +0200 Subject: [PATCH] Adjusted error handling --- pkg/azurestore/azureservice.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/pkg/azurestore/azureservice.go b/pkg/azurestore/azureservice.go index d1d5ad4..3c0c950 100644 --- a/pkg/azurestore/azureservice.go +++ b/pkg/azurestore/azureservice.go @@ -18,6 +18,7 @@ import ( "context" "encoding/base64" "encoding/binary" + "errors" "fmt" "io" "net/http" @@ -351,6 +352,9 @@ func getSasToken(sasUrl string) (sas string, err error) { return "", err } defer resp.Body.Close() + if resp.StatusCode != 200 { + return "", errors.New("Error at requesting SAS Token: " + resp.Status) + } sasResponse, readErr := io.ReadAll(resp.Body) if readErr != nil { return "", readErr