Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

API looking fo summoner #7

Closed
massimo0307 opened this issue Oct 10, 2021 · 2 comments
Closed

API looking fo summoner #7

massimo0307 opened this issue Oct 10, 2021 · 2 comments
Assignees
Labels
question Further information is requested

Comments

@massimo0307
Copy link

massimo0307 commented Oct 10, 2021

using a summoner who DO NOT EXISTS the output is 👍
$summoner = $api->getSummonerByName($summonerName);

Fatal error: Uncaught RiotAPI\Base\Exceptions\ForbiddenException: LeagueAPI: Forbidden. Data not found - summoner not found in /home/xxx.cloudwaysapps.com/fxzmmrqygx/public_html/vendor/dolejska-daniel/riot-api-base/src/Base/BaseAPI.php:1127 Stack trace:
#0 /home/140198.cloudwaysapps.com/fxzmmrqygx/public_html/vendor/dolejska-daniel/riot-api-base/src/Base/BaseAPI.php(1063): RiotAPI\Base\BaseAPI->processCallResult()
#1 /home/xxx.cloudwaysapps.com/fxzmmrqygx/public_html/vendor/guzzlehttp/promises/src/Promise.php(204): RiotAPI\Base\BaseAPI->RiotAPI\Base\{closure}()
#2 /home/xxx.cloudwaysapps.com/fxzmmrqygx/public_html/vendor/guzzlehttp/promises/src/Promise.php(153): GuzzleHttp\Promise\Promise::callHandler()
#3 /home/xxx.cloudwaysapps.com/fxzmmrqygx/public_html/vendor/guzzlehttp/promises/src/TaskQueue.php(48): GuzzleHttp\Promise\Promise::GuzzleHttp\Promise\{closure}()
#4 /home/xx.cloudwaysapps.com/fxzmmrqygx/public_html/vendor/guzzlehttp/guzzle/src/Handler/CurlMultiHandler.php(158): GuzzleHttp\Promise\TaskQueue in /home/140198.cloudwaysapps.com/fxzmmrqygx/public_html/vendor/dolejska-daniel/riot-api-base/src/Base/BaseAPI.php on line 1127

The answer is correct but it stop working

P.s.
Excellent work!!

@dolejska-daniel dolejska-daniel self-assigned this Oct 13, 2021
@dolejska-daniel dolejska-daniel added the question Further information is requested label Oct 13, 2021
@dolejska-daniel
Copy link
Owner

Hello, sorry for the delay! I'm not quite sure what the problem is. If the summoner is not found by the API, the library raises an exception - this stops the program if not caught in try-catch block. Is this what you're looking for?

<?php
// ...
try {
    $summoner = $api->getSummonerByName($summonerName);
} catch (RiotAPI\Base\Exceptions\ForbiddenException $ex) {
    // handle summoner not being found
}

@massimo0307
Copy link
Author

massimo0307 commented Oct 13, 2021 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants