Skip to content

Unhandled error if one of steam ids doesn't exist #82

@andreich1980

Description

@andreich1980

When pass steamId that does not exist there's an error:
Undefined property: stdClass::$steamid {"exception":"[object] (ErrorException(code: 0): Undefined property: stdClass::$steamid at /home/XXXXX/website/vendor/syntax/steam-api/src/Syntax/SteamApi/Containers/Player.php:59)

Steam Response from http://api.steampowered.com/ISteamUser/GetPlayerSummaries/v0002/?key=KEY&steamids=76561197985417306,76561198852391316

{
    "response":{
        "players":[
            {
                "steamid":"76561197985417306",
                "communityvisibilitystate":3,
                "profilestate":1,
                "personaname":"NicoPax",
                "lastlogoff":1545763298,
                "profileurl":"https://steamcommunity.com/profiles/76561197985417306/",
                "avatar":"https://steamcdn-a.akamaihd.net/steamcommunity/public/images/avatars/12/12d3cc096fde0e713c9913a8cb9449f77b85eb99.jpg",
                "avatarmedium":"https://steamcdn-a.akamaihd.net/steamcommunity/public/images/avatars/12/12d3cc096fde0e713c9913a8cb9449f77b85eb99_medium.jpg",
                "avatarfull":"https://steamcdn-a.akamaihd.net/steamcommunity/public/images/avatars/12/12d3cc096fde0e713c9913a8cb9449f77b85eb99_full.jpg",
                "personastate":0,
                "realname":"Greg Packham",
                "primaryclanid":"103582791429521408",
                "timecreated":1160298071,
                "personastateflags":0,
                "loccountrycode":"ZA",
                "locstatecode":"11",
                "loccityid":46719
            },
            {

            }
        ]
    }
}

Code example:

SteamApi::user([76561197985417306,76561198852391316])->GetPlayerSummaries()

Probably you should skip such empty data.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions