Добавлена обработка и логгирование ошибок для очереди задач

This commit is contained in:
ErickSkrauch 2017-11-29 02:38:11 +03:00
parent ea033f70bc
commit 868ee1c61c
2 changed files with 23 additions and 0 deletions

View File

@ -0,0 +1,20 @@
<?php
namespace console\components;
use Swift_TransportException;
use Yii;
use yii\queue\ErrorEvent;
class ErrorHandler {
public function handleQueueError(ErrorEvent $error): void {
$exception = $error->error;
if ($exception instanceof Swift_TransportException) {
Yii::warning($exception);
return;
}
Yii::error($exception);
}
}

View File

@ -26,6 +26,9 @@ return [
'urlManager' => [
'hostInfo' => getenv('DOMAIN') ?: 'https://account.ely.by',
],
'queue' => [
'on afterError' => [new console\components\ErrorHandler(), 'handleQueueError'],
],
],
'controllerMap' => [
'migrate' => [