Skip to content

Commit 9a44948

Browse files
authored
Merge pull request #339 from saloonphp/feature/v3-remove-distrating-@throws
Fix | V3 - Remove Distracting @throws from PHPDocs
2 parents 4c68cc0 + e6f19fe commit 9a44948

File tree

5 files changed

+23
-15
lines changed

5 files changed

+23
-15
lines changed

src/Exceptions/Request/FatalRequestException.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,15 @@
88
use Saloon\Http\PendingRequest;
99
use Saloon\Exceptions\SaloonException;
1010

11+
/**
12+
* FatalRequestException
13+
*
14+
* This exception is thrown when the sender encountered a problem before the API
15+
* was able to respond. For example: An issue with connecting to the API or
16+
* an SSL error.
17+
*
18+
* @see https://docs.saloon.dev/the-basics/handling-failures
19+
*/
1120
class FatalRequestException extends SaloonException
1221
{
1322
/**

src/Exceptions/Request/RequestException.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,13 @@
1010
use Saloon\Helpers\StatusCodeHelper;
1111
use Saloon\Exceptions\SaloonException;
1212

13+
/**
14+
* RequestException
15+
*
16+
* This exception is thrown when the response from a request is a failed response.
17+
*
18+
* See @https://docs.saloon.dev/the-basics/handling-failures
19+
*/
1320
class RequestException extends SaloonException
1421
{
1522
/**

src/Http/PendingRequest.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,6 @@ class PendingRequest
7575

7676
/**
7777
* Build up the request payload.
78-
*
79-
* @throws \Saloon\Exceptions\DuplicatePipeNameException
8078
*/
8179
public function __construct(Connector $connector, Request $request, MockClient $mockClient = null)
8280
{

src/Traits/Connector/SendsRequests.php

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,6 @@ trait SendsRequests
2525
* Send a request synchronously
2626
*
2727
* @param callable(\Throwable, \Saloon\Http\Request): (bool)|null $handleRetry
28-
* @throws \ReflectionException
29-
* @throws \Throwable
3028
*/
3129
public function send(Request $request, MockClient $mockClient = null, callable $handleRetry = null): Response
3230
{
@@ -152,8 +150,6 @@ public function sendAsync(Request $request, MockClient $mockClient = null): Prom
152150
* Send a synchronous request and retry if it fails
153151
*
154152
* @param callable(\Throwable, \Saloon\Http\Request): (bool)|null $handleRetry
155-
* @throws \ReflectionException
156-
* @throws \Throwable
157153
*/
158154
public function sendAndRetry(Request $request, int $tries, int $interval = 0, callable $handleRetry = null, bool $throw = true, MockClient $mockClient = null): Response
159155
{
@@ -166,8 +162,6 @@ public function sendAndRetry(Request $request, int $tries, int $interval = 0, ca
166162

167163
/**
168164
* Create a new PendingRequest
169-
*
170-
* @throws \ReflectionException
171165
*/
172166
public function createPendingRequest(Request $request, MockClient $mockClient = null): PendingRequest
173167
{

src/Traits/ManagesExceptions.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,19 +18,19 @@ public function hasRequestFailed(Response $response): ?bool
1818
}
1919

2020
/**
21-
* Determine if we should throw an exception if the `$response->throw()` ({@see \Saloon\Http\Response::throw()})
22-
* is used, or when AlwaysThrowOnErrors is used.
21+
* Get the request exception.
2322
*/
24-
public function shouldThrowRequestException(Response $response): bool
23+
public function getRequestException(Response $response, ?Throwable $senderException): ?Throwable
2524
{
26-
return $response->failed();
25+
return null;
2726
}
2827

2928
/**
30-
* Get the request exception.
29+
* Determine if we should throw an exception if the `$response->throw()` is
30+
* used, or when the `AlwaysThrowOnErrors` trait is used.
3131
*/
32-
public function getRequestException(Response $response, ?Throwable $senderException): ?Throwable
32+
public function shouldThrowRequestException(Response $response): bool
3333
{
34-
return null;
34+
return $response->failed();
3535
}
3636
}

0 commit comments

Comments
 (0)