meraki-analytics / orianna

A Java framework for the Riot Games League of Legends API (http://developer.riotgames.com/).
MIT License
182 stars 56 forks source link

Unranked Summoner - APIException #36

Closed JeffreyCA closed 9 years ago

JeffreyCA commented 9 years ago

The following code does not work for any unranked players in a mixed rank game (both ranked & unranked players in the game).

for (League league : par.get(i).getSummoner().getLeagueEntries()) {
    LeagueEntry entry = league.getParticipantEntry();
    if (league.getQueueType().name().equals("RANKED_SOLO_5x5")) {
        solo_queue_ranks[i] = league.getTier() + " " + entry.getDivision() +
                " " + entry.getLeaguePoints();
        break;
    }
    else {
        solo_queue_ranks[i] = "";
    }
}

I get an APIException 404 Not Found: com.robrua.orianna.type.exception.APIException: A NOT_FOUND (404) error was received from the server for URI https://na.api.pvp.net/api/lol/na/v2.5/league/by-summoner/32172885/entry?api_key=744e79b3-a84f-49c2-aa78-4fab3d9b0401

`

robrua commented 9 years ago

This is the intended behavior when the API sends a 404 error. You should use a try/catch block to react appropriately in the context of your application if the summoner has no leagues.

Also, you'll want to regenerate your API key as it's shown in this comment.

JeffreyCA commented 9 years ago

Thanks, I fixed it.