使Laravel不报告电子邮件异常

问题描述 投票:0回答:1

我在停止报告laravel的特定异常时遇到麻烦。

以下是例外:

Message
Connection to tcp://smtp.pepipost.com:587 Timed Out
Level
ERROR
Exception
{
   "class": "Swift_TransportException",
   "message": "Connection to tcp://smtp.pepipost.com:587 Timed Out"

所以...我想让它停止被报告,因为它在闲暇时发垃圾邮件。我在Exceptions \ Handler.php中尝试了以下操作:

if ($exception instanceof Swift_TransportException) {
     //
}
else{
     parent::report($exception);
}

但是它仍然报告。我知道我可以向处理程序的$ dontReport属性添加一个类,但是我不知道如何编写路径。它在供应商文件夹中:\ vendor \ swiftmailer \ swiftmailer \ lib \ classes \ Swift \ TransportException.php,这是我不应该报告的类。请帮忙。

laravel exception swiftmailer
1个回答
0
投票

您提到$dontReport,但您尝试过以下方法:

/**
 * A list of the exception types that are not reported.
 *
 * @var array
 */
protected $dontReport = [
    \Swift_TransportException::class
];
© www.soinside.com 2019 - 2024. All rights reserved.