π₯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
Handling failures with promises
Customising when Saloon thinks a request has failed
Customising the request exception
Last updated