Skip to content

Commit

Permalink
Improve personalizer error handling.
Browse files Browse the repository at this point in the history
  • Loading branch information
zyro committed Jan 17, 2024
1 parent fad3af8 commit d8b78af
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions personalizer_satori.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,10 @@ func (p *SatoriPersonalizer) GetValue(ctx context.Context, logger runtime.Logger

flagList, err := nk.GetSatori().FlagsList(ctx, userID, flagName)
if err != nil {
if strings.Contains(err.Error(), "404 status code") {
logger.WithField("userID", userID).WithField("error", err.Error()).Warn("error requesting Satori flag list, user not found")
return nil, nil
}
logger.WithField("userID", userID).WithField("error", err.Error()).Error("error requesting Satori flag list")
return nil, err
}
Expand All @@ -93,6 +97,10 @@ func (p *SatoriPersonalizer) GetValue(ctx context.Context, logger runtime.Logger
// If looking at event leaderboards, also load live events.
liveEventsList, err := nk.GetSatori().LiveEventsList(ctx, userID)
if err != nil {
if strings.Contains(err.Error(), "404 status code") {
logger.WithField("userID", userID).WithField("error", err.Error()).Warn("error requesting Satori live events list, user not found")
return nil, nil
}
logger.WithField("userID", userID).WithField("error", err.Error()).Error("error requesting Satori live events list")
return nil, err
}
Expand Down

0 comments on commit d8b78af

Please sign in to comment.