Skip to content

Commit

Permalink
improve Steam logs on GetSteamProfile error (#1120)
Browse files Browse the repository at this point in the history
  • Loading branch information
Luke Gehorsam authored Oct 30, 2023
1 parent 5681444 commit 8e8a0fe
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 1 addition & 1 deletion server/core_authenticate.go
Original file line number Diff line number Diff line change
Expand Up @@ -831,7 +831,7 @@ func importSteamFriends(ctx context.Context, logger *zap.Logger, db *sql.DB, mes

steamProfiles, err := client.GetSteamFriends(ctx, publisherKey, steamId)
if err != nil {
logger.Info("Could not import Steam friends.", zap.Error(err))
logger.Error("Could not import Steam friends.", zap.Error(err))
return status.Error(codes.Unauthenticated, "Could not authenticate Steam profile.")
}

Expand Down
3 changes: 3 additions & 0 deletions social/social.go
Original file line number Diff line number Diff line change
Expand Up @@ -626,12 +626,15 @@ func (c *Client) GetSteamProfile(ctx context.Context, publisherKey string, appID
var profileWrapper SteamProfileWrapper
err := c.request(ctx, "steam profile", path, nil, &profileWrapper)
if err != nil {
c.logger.Debug("Error requesting Steam profile", zap.Error(err))
return nil, err
}
if profileWrapper.Response.Error != nil {
c.logger.Debug("Error returned from Steam after requesting Steam profile", zap.String("errorDescription", profileWrapper.Response.Error.ErrorDesc), zap.Int("errorCode", profileWrapper.Response.Error.ErrorCode))
return nil, fmt.Errorf("%v, %v", profileWrapper.Response.Error.ErrorDesc, profileWrapper.Response.Error.ErrorCode)
}
if profileWrapper.Response.Params == nil {
c.logger.Debug("No profile returned from Steam after requesting Steam profile")
return nil, errors.New("no steam profile")
}
return profileWrapper.Response.Params, nil
Expand Down

0 comments on commit 8e8a0fe

Please sign in to comment.