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

Fix | V3 - Remove Distracting @throws from PHPDocs #339

Merged
merged 1 commit into from
Nov 30, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions src/Exceptions/Request/FatalRequestException.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,15 @@
use Saloon\Http\PendingRequest;
use Saloon\Exceptions\SaloonException;

/**
* FatalRequestException
*
* This exception is thrown when the sender encountered a problem before the API
* was able to respond. For example: An issue with connecting to the API or
* an SSL error.
*
* @see https://docs.saloon.dev/the-basics/handling-failures
*/
class FatalRequestException extends SaloonException
{
/**
Expand Down
7 changes: 7 additions & 0 deletions src/Exceptions/Request/RequestException.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,13 @@
use Saloon\Helpers\StatusCodeHelper;
use Saloon\Exceptions\SaloonException;

/**
* RequestException
*
* This exception is thrown when the response from a request is a failed response.
*
* See @https://docs.saloon.dev/the-basics/handling-failures
*/
class RequestException extends SaloonException
{
/**
Expand Down
2 changes: 0 additions & 2 deletions src/Http/PendingRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,6 @@ class PendingRequest

/**
* Build up the request payload.
*
* @throws \Saloon\Exceptions\DuplicatePipeNameException
*/
public function __construct(Connector $connector, Request $request, MockClient $mockClient = null)
{
Expand Down
6 changes: 0 additions & 6 deletions src/Traits/Connector/SendsRequests.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,6 @@ trait SendsRequests
* Send a request synchronously
*
* @param callable(\Throwable, \Saloon\Http\Request): (bool)|null $handleRetry
* @throws \ReflectionException
* @throws \Throwable
*/
public function send(Request $request, MockClient $mockClient = null, callable $handleRetry = null): Response
{
Expand Down Expand Up @@ -152,8 +150,6 @@ public function sendAsync(Request $request, MockClient $mockClient = null): Prom
* Send a synchronous request and retry if it fails
*
* @param callable(\Throwable, \Saloon\Http\Request): (bool)|null $handleRetry
* @throws \ReflectionException
* @throws \Throwable
*/
public function sendAndRetry(Request $request, int $tries, int $interval = 0, callable $handleRetry = null, bool $throw = true, MockClient $mockClient = null): Response
{
Expand All @@ -166,8 +162,6 @@ public function sendAndRetry(Request $request, int $tries, int $interval = 0, ca

/**
* Create a new PendingRequest
*
* @throws \ReflectionException
*/
public function createPendingRequest(Request $request, MockClient $mockClient = null): PendingRequest
{
Expand Down
14 changes: 7 additions & 7 deletions src/Traits/ManagesExceptions.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,19 +18,19 @@ public function hasRequestFailed(Response $response): ?bool
}

/**
* Determine if we should throw an exception if the `$response->throw()` ({@see \Saloon\Http\Response::throw()})
* is used, or when AlwaysThrowOnErrors is used.
* Get the request exception.
*/
public function shouldThrowRequestException(Response $response): bool
public function getRequestException(Response $response, ?Throwable $senderException): ?Throwable
{
return $response->failed();
return null;
}

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