π₯Handling Failures
<?php
$forge = new ForgeConnector;
$response = $forge->send(new ErrorRequest);
$response->failed(); // true
$response->status(); // 500
$response->body(); // {"message": "Server Error"}Always throw exceptions on failed requests
<?php
use Saloon\Traits\Plugins\AlwaysThrowOnErrors;
class ForgeConnector extends Connector
{
use AlwaysThrowOnErrors;
// {...}
}Using the throw method
Response Exceptions
Using the onError method
Handling failures with promises
Other response methods
Method
Description
Customising when Saloon thinks a request has failed
Customising when exceptions are thrown
Customising the request exception
Last updated