Description
Hi, how can I check the existence of a user?
I tried using this:
$user = $client->api('user')->show('usernameToSearch');
If the user exists, I don't find any problems; if the user does not exist, I get this:
Fatal error: Uncaught Github\Exception\RuntimeException: Not Found in C:\xampp\htdocs\github\vendor\knplabs\github-api\lib\Github\HttpClient\Plugin\GithubExceptionThrower.php:98 Stack trace: #0 C:\xampp\htdocs\github\vendor\php-http\httplug\src\Promise\HttpFulfilledPromise.php(34): Github\HttpClient\Plugin\GithubExceptionThrower->Github\HttpClient\Plugin{closure}(Object(GuzzleHttp\Psr7\Response)) #1 C:\xampp\htdocs\github\vendor\knplabs\github-api\lib\Github\HttpClient\Plugin\GithubExceptionThrower.php(99): Http\Client\Promise\HttpFulfilledPromise->then(Object(Closure)) #2 C:\xampp\htdocs\github\vendor\php-http\client-common\src\PluginClient.php(161): Github\HttpClient\Plugin\GithubExceptionThrower->handleRequest(Object(GuzzleHttp\Psr7\Request), Object(Closure), Object(Closure)) #3 C:\xampp\htdocs\github\vendor\php-http\client-common\src\PluginClient.php(175): Http\Client\Common\PluginClient->Http\Client\Common{closure}(Object(GuzzleHttp\Psr7\Request)) #4 C:\xampp\htdocs\github\vendor\php-http\client-common\src\PluginCl in C:\xampp\htdocs\github\vendor\knplabs\github-api\lib\Github\HttpClient\Plugin\GithubExceptionThrower.php on line 98
My goal is to show a "User does not exist" message, rather than showing the Fatal Error.