Skip to content

Commit

Permalink
Check for authentication error
Browse files Browse the repository at this point in the history
Signed-off-by: Rick Brouwer <[email protected]>
  • Loading branch information
rickbrouwer committed Oct 2, 2024
1 parent 1350115 commit dc66dcc
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions pkg/scalers/ibmmq_scaler.go
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,10 @@ func (s *ibmmqScaler) getQueueDepthViaHTTP(ctx context.Context) (int64, error) {
}
defer resp.Body.Close()

if resp.StatusCode == http.StatusUnauthorized {
return 0, fmt.Errorf("authentication failed: incorrect username or password")
}

body, err := io.ReadAll(resp.Body)
if err != nil {
return 0, fmt.Errorf("failed to read body of request for queue %s: %w", queueName, err)
Expand Down

0 comments on commit dc66dcc

Please sign in to comment.