Skip to content

Commit

Permalink
修复执行定时任务时抛出 PDOException 无法正确捕获并二次抛出异常 (#431)
Browse files Browse the repository at this point in the history
  • Loading branch information
Yurunsoft committed Sep 16, 2022
1 parent 79827dd commit 86bb189
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/Cron/CronWorker.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,8 @@ public function exec(string $id, $data, $task, string $type)
}
catch (\Throwable $th)
{
throw new \RuntimeException(sprintf('Task %s execution failed, message: %s', $id, $th->getMessage()), $th->getCode(), $th);
$code = $th->getCode();
throw new \RuntimeException(sprintf('Task %s execution failed, message: %s', $id, $th->getMessage()), \is_int($code) ? $code : 0, $th);
}
}
else
Expand Down

0 comments on commit 86bb189

Please sign in to comment.