Answer the question
In order to leave comments, you need to log in
How to catch 503 error in php, yii2?
On yii2, when sending a curl request with a non-working proxy, the server gives a 503 error, what kind of exception to catch it in catch? If you write your own, then hint where to look, or better, skinte the code.
curl options:
[
[42] => 1
[81] =>
[64] =>
[19913] => 1
[2] => 1
[10004] => 35.45.45.45:45
[10006] => rfgth:fgn
[101] => 0
[10002] => https://google.com/
]
Answer the question
In order to leave comments, you need to log in
try {
//Код с ошибкой
} catch (Exception $e) {
if ($e->getCode() === 503) {
///Ваша обработка
}
Yii::$app->errorHandler->logException($e); //Записываем ошибку в лог
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question