Skip to content

Commit

Permalink
Check trace
Browse files Browse the repository at this point in the history
  • Loading branch information
rmcdaniel committed Aug 27, 2023
1 parent 5b81fdb commit 252ff9e
Showing 1 changed file with 5 additions and 17 deletions.
22 changes: 5 additions & 17 deletions app/Http/Controllers/WorkflowsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,11 @@ public function show($id) {
$flow->exceptions = $flow->exceptions->map(function ($exception) {
$exception->code ??= null;
$unserialized = Y::unserialize($exception->exception);
if (is_array($unserialized) && array_key_exists('class', $unserialized) && is_subclass_of($unserialized['class'], \Throwable::class)) {
if (is_array($unserialized)
&& array_key_exists('class', $unserialized)
&& is_subclass_of($unserialized['class'], \Throwable::class)
&& file_exists($unserialized['file'])
) {
$file = new SplFileObject($unserialized['file']);
$file->seek($unserialized['line'] - 4);
for ($line = 0; $line < 7; ++$line) {
Expand All @@ -54,22 +58,6 @@ public function show($id) {
}
$exception->code = rtrim($exception->code);
$exception->exception = serialize($unserialized);
} else {
if (is_object($unserialized) && method_exists($unserialized, 'getFile')) {
$file = new SplFileObject($unserialized->getFile());
$file->seek($unserialized->getLine() - 4);
for ($line = 0; $line < 7; ++$line) {
$exception->code .= $file->current();
$file->next();
if ($file->eof()) break;
}
$exception->code = rtrim($exception->code);
try {
$unserialized->trace = $unserialized->getTrace();
} catch (\Throwable $th) {
}
}
$exception->exception = serialize($unserialized);
}
return $exception;
});
Expand Down

0 comments on commit 252ff9e

Please sign in to comment.