I am currently catching an exception for when an identity is not verified using the following code -
use Aws\Ses\SesClient;
use Aws\Ses\Exception;
try {
$result = $ses->sendEmail($data);
} catch (Exception $e) {
echo $e->getResponse();
}
It prints out the following -
PHP Fatal error: Uncaught exception 'Aws\Ses\Exception\SesException'
with message 'Error executing "SendEmail" on "https://email.us-
west-2.amazonaws.com"; AWS HTTP error: Client error: `POST
https://email.us-west-2.amazonaws.com` resulted in a `400 Bad Request`
response:
<ErrorResponse xmlns="http://ses.amazonaws.com/doc/2010-12-01/">
<Error>
<Type>Sender</Type>
<Code>MessageReje (truncated...)
MessageRejected (client): Email address is not verified. The
following identities failed the check in region US-WEST-2:
arn:aws:ses:us-west-2:**************** - <ErrorResponse
xmlns="http://ses.amazonaws.com/doc/2010-12-01/">
<Error>
<Type>Sender</Type>
<Code>MessageRejected</Code>
<Message>Email address is not verified. The following identities
failed the check in region US-WEST-2: arn:aws:ses:us-
west-2:************</Message>
</Error>
<RequestId>*****************</RequestId>
</ErrorResponse>
exception 'GuzzleHttp\Exception\ClientException' with in /var/www
/html/data/aws/Aws/WrappedHttpHandler.php on line 159
I cannot get any of the methods outlined on the following page to print out anything different -
http://docs.aws.amazon.com/aws-sdk-php/v2/api/class-Aws.Ses.Exception.SesException.html
Any ideas how I can get an actual error code out of this exception so that I can take the appropriate action in the rest of my script?