This commit is contained in:
2022-09-25 17:15:23 +08:00
parent 354013fa41
commit eda1955956
+2 -2
View File
@@ -1161,12 +1161,12 @@ if (!function_exists('throwable')) {
*/ */
function throwable(\Throwable|\Error $throwable): string function throwable(\Throwable|\Error $throwable): string
{ {
$message = $throwable->getMessage() . ' ' . $throwable->getFile() . " at line " . $throwable->getLine() . "\n"; $message = $throwable->getMessage() . ' ' . $throwable->getFile() . " at line " . $throwable->getLine() . PHP_EOL;
foreach ($throwable->getTrace() as $value) { foreach ($throwable->getTrace() as $value) {
if (!isset($value['file'])) { if (!isset($value['file'])) {
continue; continue;
} }
$message .= $value['file'] . " -> " . (isset($value['class']) ? $value['class'] . '::' : '') . ($value['function'] ?? 'Closure') . "(" . $value['line'] . ")\n"; $message .= $value['file'] . " -> " . (isset($value['class']) ? $value['class'] . '::' : '') . ($value['function'] ?? 'Closure') . "(" . $value['line'] . ")" . PHP_EOL;
} }
return $message; return $message;
} }