【发布时间】:2016-11-08 13:56:17
【问题描述】:
我目前正在捕获未使用以下代码验证身份的异常 -
use Aws\Ses\SesClient;
use Aws\Ses\Exception;
try {
$result = $ses->sendEmail($data);
} catch (Exception $e) {
echo $e->getResponse();
}
它打印出以下内容 -
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
我无法使用下一页概述的任何方法来打印出任何不同的东西 -
http://docs.aws.amazon.com/aws-sdk-php/v2/api/class-Aws.Ses.Exception.SesException.html
有什么想法可以从这个异常中得到一个实际的错误代码,以便我可以在脚本的其余部分采取适当的操作吗?
【问题讨论】:
-
您确定您使用的是正确的命名空间吗?
Aws\Ses\Exception\SesException显示在文档中。您可能希望将异常命名为 @Dekel 提示的别名。由于您正在命名Aws\Ses\Exception,因此您可以尝试捕获SesException并在那里处理它。
标签: php amazon-web-services amazon-ses