Skip to content

Commit

Permalink
fix: cover status code not 200 case
Browse files Browse the repository at this point in the history
  • Loading branch information
HashMapsData2Value committed Oct 24, 2024
1 parent 5958f3d commit 0dfe81c
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions internal/accounts.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ package internal

import (
"context"
"errors"
"fmt"
"time"

"github.com/algorandfoundation/hack-tui/api"
Expand Down Expand Up @@ -39,6 +41,10 @@ func getAccountOnlineStatus(client *api.ClientWithResponses, address string) (st
return "N/A", err
}

if r.StatusCode() != 200 {
return "N/A", errors.New(fmt.Sprintf("Failed to get account information. Received error code: %d", r.StatusCode()))
}

return r.JSON200.Status, nil
}

Expand Down

0 comments on commit 0dfe81c

Please sign in to comment.