dolejska-daniel / riot-api

Riot League of Legends & DataDragon API wrappers for PHP7 and PHP8.
GNU General Public License v3.0
112 stars 25 forks source link

Throw error in case summoner name is empty #85

Closed TheKeymaster closed 4 years ago

TheKeymaster commented 4 years ago

Currently when the summoner name is empty, the error you get says nothing about the actual issue.

$api->getSummonerByName('');

// Will throw an RiotAPI\LeagueAPI\Exceptions\ForbiddenException with the message "LeagueAPI: Forbidden. Forbidden"

After this change it is clear that the user has done something wrong:

$api->getSummonerByName('');

// Will throw an \RiotAPI\LeagueAPI\Exceptions\RequestParameterException with the message "Provided summoner name must not be empty"

Such checks are already made in several other methods for the tournerment API, like \RiotAPI\LeagueAPI\LeagueAPI::createTournament.

If this check was there before I would've saved a bit of time debugging. I actually thought my API token was wrong or invalid the whole time 🙈.

dolejska-daniel commented 4 years ago

Nice work! Thank you for your contribution! ❤️