1 В избранное 0 Ответвления 0

OSCHINA-MIRROR/talent518-threadtask

Присоединиться к Gitlife
Откройте для себя и примите участие в публичных проектах с открытым исходным кодом с участием более 10 миллионов разработчиков. Приватные репозитории также полностью бесплатны :)
Присоединиться бесплатно
Это зеркальный репозиторий, синхронизируется ежедневно с исходного репозитория.
Клонировать/Скачать
ErrorHandler.php 1.8 КБ
Копировать Редактировать Исходные данные Просмотреть построчно История
阿宝 Отправлено 4 лет назад 8d87a35
<?php
namespace app\threadtask;
use Yii;
use yii\helpers\VarDumper;
use yii\web\Response;
class ErrorHandler extends \yii\web\ErrorHandler {
public function register() {
}
public function unregister() {
}
/**
* @inheritdoc
*/
public function handleException($exception)
{
$this->exception = $exception;
try {
$this->logException($exception);
if ($this->discardExistingOutput) {
$this->clearOutput();
}
$this->renderException($exception);
} catch (\Exception $e) {
// an other exception could be thrown while displaying the exception
$this->handleFallbackExceptionMessage($e, $exception);
} catch (\Throwable $e) {
// additional check for \Throwable introduced in PHP 7
$this->handleFallbackExceptionMessage($e, $exception);
}
$this->exception = null;
}
/**
* @inheritdoc
*/
protected function handleFallbackExceptionMessage($exception, $previousException)
{
$msg = "An Error occurred while handling another error:\n";
$msg .= (string) $exception;
$msg .= "\nPrevious exception:\n";
$msg .= (string) $previousException;
$response = \Yii::$app->getResponse();
$request = VarDumper::export(\Yii::$app->getRequest()->request);
if (YII_DEBUG) {
$msg .= "\n\$request = $request";
if($response->isSent) {
echo "\n$msg\n";
} else {
$response->data = $response->format === Response::FORMAT_HTML ? '<pre>' . htmlspecialchars($msg, ENT_QUOTES, Yii::$app->charset) . '</pre>' : $msg;
$response->send();
}
} else {
if($response->isSent) {
echo "\n$msg\n\$request = $request\n";
} else {
$response->data = 'An internal server error occurred.';
$response->send();
}
}
error_log($msg);
}
public function renderRequest() {
return '<pre>' . $this->htmlEncode(VarDumper::dump(\Yii::$app->getRequest()->request, 4, true)) . '</pre>';
}
}

Комментарий ( 0 )

Вы можете оставить комментарий после Вход в систему

1
https://gitlife.ru/oschina-mirror/talent518-threadtask.git
git@gitlife.ru:oschina-mirror/talent518-threadtask.git
oschina-mirror
talent518-threadtask
talent518-threadtask
v1.68