Enable better logging for queue

This commit is contained in:
ErickSkrauch 2023-10-15 04:09:09 +02:00
parent a1eb5f3be6
commit b98649070d
No known key found for this signature in database
GPG Key ID: 669339FCBB30EE0E

View File

@ -3,20 +3,13 @@ declare(strict_types=1);
namespace console\components; namespace console\components;
use Swift_TransportException;
use Yii; use Yii;
use yii\queue\ExecEvent; use yii\queue\ExecEvent;
class ErrorHandler { final class ErrorHandler {
public function handleQueueError(ExecEvent $error): void { public function handleQueueError(ExecEvent $event): void {
$exception = $error->error; Yii::$app->errorHandler->handleException($event->error);
if ($exception instanceof Swift_TransportException) {
Yii::warning($exception);
return;
}
Yii::error($exception);
} }
} }