diff --git a/src/Error.php b/src/Error.php index 17b039b0c02cb6703168bbf45e7c89176f5a1589..f59a224f20384175a45faedfa2355c4f30e5311e 100644 --- a/src/Error.php +++ b/src/Error.php @@ -77,37 +77,42 @@ class Error */ public static function report($type, $exception) { - //标准化日志 - $text = Helper::formatException($exception, $type); + try { + //标准化日志 + $text = Helper::formatException($exception, $type); - //本地日志储存 - Helper::writeLog($text); + //本地日志储存 + Helper::writeLog($text); - //同步模式输出 - if (!Env::get('daemon')) echo($text); + //同步模式输出 + if (!Env::get('daemon')) echo($text); - //回调上报信息 - $notify = Env::get('notifyHand'); - if ($notify) - { - //闭包回调 - if ($notify instanceof Closure) + //回调上报信息 + $notify = Env::get('notifyHand'); + if ($notify) { - $notify($exception); - return; - } + //闭包回调 + if ($notify instanceof Closure) + { + $notify($exception); + return; + } - //Http回调 - $request = [ - 'errStr' => $exception->getMessage(), - 'errFile' => $exception->getFile(), - 'errLine' => $exception->getLine(), - ]; - $result = Helper::curl($notify, $request); - if (!$result || $result != 'success') - { - Helper::showError("request http api $notify failed", false, 'warring', true); + //Http回调 + $request = [ + 'errStr' => $exception->getMessage(), + 'errFile' => $exception->getFile(), + 'errLine' => $exception->getLine(), + ]; + $result = Helper::curl($notify, $request); + if (!$result || $result != 'success') + { + Helper::showError("request http api $notify failed", false, 'warring', true); + } } + }catch (\Throwable $e){ + echo $e->getMessage(); + echo "\r\n"; } } } \ No newline at end of file