mirror of
https://github.com/elyby/accounts.git
synced 2024-11-09 23:12:20 +05:30
Добавлена обработка и логгирование ошибок для очереди задач
This commit is contained in:
parent
ea033f70bc
commit
868ee1c61c
20
console/components/ErrorHandler.php
Normal file
20
console/components/ErrorHandler.php
Normal 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);
|
||||
}
|
||||
|
||||
}
|
@ -26,6 +26,9 @@ return [
|
||||
'urlManager' => [
|
||||
'hostInfo' => getenv('DOMAIN') ?: 'https://account.ely.by',
|
||||
],
|
||||
'queue' => [
|
||||
'on afterError' => [new console\components\ErrorHandler(), 'handleQueueError'],
|
||||
],
|
||||
],
|
||||
'controllerMap' => [
|
||||
'migrate' => [
|
||||
|
Loading…
Reference in New Issue
Block a user