Skip to content

Commit c580e61

Browse files
committed
♻️ Refactor code
1 parent bc92c46 commit c580e61

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

src/Builder.php

+4-2
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
use GuzzleHttp\Exception\ClientException;
88
use GuzzleHttp\Exception\ServerException;
99
use Illuminate\Config\Repository;
10+
use Illuminate\Http\Client\RequestException;
1011
use Illuminate\Http\Response;
1112
use Illuminate\Pagination\Paginator;
1213
use Illuminate\Support\Collection;
@@ -1431,7 +1432,7 @@ public function get()
14311432
$endpoint = ApiHelper::retrieveAccessToken();
14321433

14331434
if (!$this->endpoint) {
1434-
throw new MissingEndpointException('Please provide an endpoint.');
1435+
throw new MissingEndpointException();
14351436
}
14361437

14371438
$cacheKey = 'igdb_cache.' . md5($this->endpoint . $this->getQuery());
@@ -1447,6 +1448,7 @@ function () use ($endpoint) {
14471448
])
14481449
->withBody($this->getQuery(), 'plain/text')
14491450
->post($this->endpoint)
1451+
->throw()
14501452
->json();
14511453
});
14521454

@@ -1579,7 +1581,7 @@ public function firstOrFail()
15791581
public function count()
15801582
{
15811583
if (!$this->endpoint) {
1582-
throw new MissingEndpointException('Please provide an endpoint.');
1584+
throw new MissingEndpointException();
15831585
}
15841586

15851587
$accessToken = ApiHelper::retrieveAccessToken();

src/Exceptions/MissingEndpointException.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,5 @@
66

77
class MissingEndpointException extends Exception
88
{
9-
//
9+
protected $message = 'Please provide an endpoint.';
1010
}

0 commit comments

Comments
 (0)