Skip to content

Commit

Permalink
feat: properly ignore warning errors
Browse files Browse the repository at this point in the history
Signed-off-by: Matt Gleich <[email protected]>
  • Loading branch information
gleich committed Dec 5, 2024
1 parent dcdb271 commit 2fd8f3d
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 5 deletions.
5 changes: 4 additions & 1 deletion internal/apis/applemusic/api.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package applemusic

import (
"errors"
"fmt"
"net/http"
"strings"
Expand All @@ -26,7 +27,9 @@ func sendAppleMusicAPIRequest[T any](path string) (T, error) {

resp, err := apis.SendRequest[T](req)
if err != nil {
lumber.Error(err, "failed to make apple music API request")
if !errors.Is(err, apis.WarningError) {
lumber.Error(err, "failed to make apple music API request")
}
return zeroValue, err
}
return resp, nil
Expand Down
5 changes: 4 additions & 1 deletion internal/apis/steam/achievements.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package steam

import (
"encoding/json"
"errors"
"fmt"
"io"
"net/http"
Expand Down Expand Up @@ -108,7 +109,9 @@ func fetchGameAchievements(appID int32) (*float32, *[]achievement) {
}
gameSchema, err := apis.SendRequest[schemaGameResponse](req)
if err != nil {
lumber.Error(err, "failed to get game schema for app id:", appID)
if !errors.Is(err, apis.WarningError) {
lumber.Error(err, "failed to get game schema for app id:", appID)
}
return nil, nil
}

Expand Down
5 changes: 4 additions & 1 deletion internal/apis/steam/games.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package steam

import (
"errors"
"fmt"
"net/http"
"net/url"
Expand Down Expand Up @@ -55,7 +56,9 @@ func fetchRecentlyPlayedGames() ([]game, error) {
}
ownedGames, err := apis.SendRequest[ownedGamesResponse](req)
if err != nil {
lumber.Error(err, "sending request for owned games failed")
if !errors.Is(err, apis.WarningError) {
lumber.Error(err, "sending request for owned games failed")
}
return nil, err
}

Expand Down
5 changes: 4 additions & 1 deletion internal/apis/strava/api.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package strava

import (
"errors"
"fmt"
"net/http"
"strings"
Expand All @@ -25,7 +26,9 @@ func sendStravaAPIRequest[T any](path string, tokens tokens) (T, error) {

resp, err := apis.SendRequest[T](req)
if err != nil {
lumber.Error(err, "failed to make strava API request")
if !errors.Is(err, apis.WarningError) {
lumber.Error(err, "failed to make strava API request")
}
return zeroValue, err
}
return resp, nil
Expand Down
5 changes: 4 additions & 1 deletion internal/apis/strava/tokens.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package strava

import (
"errors"
"net/http"
"net/url"
"time"
Expand Down Expand Up @@ -45,7 +46,9 @@ func (t *tokens) refreshIfNeeded() {

tokens, err := apis.SendRequest[tokens](req)
if err != nil {
lumber.Error(err, "failed to refresh tokens")
if !errors.Is(err, apis.WarningError) {
lumber.Error(err, "failed to refresh tokens")
}
return
}

Expand Down

0 comments on commit 2fd8f3d

Please sign in to comment.