From 7efb6e8c37d824efdd6020218f1c81c5eae7271c Mon Sep 17 00:00:00 2001 From: SymfonyOnFire Date: Sun, 27 Sep 2020 13:58:01 +0200 Subject: [PATCH] replaces "Exception" type hint with "Throwable" "Throwable" catches both internal PHP errors and exceptions. "Exception" type hint doesn't catch for example a PHP error like "Attempted to call an undefined method name ....." while "Throwable" does. --- Command/ExecuteCommand.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Command/ExecuteCommand.php b/Command/ExecuteCommand.php index 854fcd7a..12dc32c1 100644 --- a/Command/ExecuteCommand.php +++ b/Command/ExecuteCommand.php @@ -183,7 +183,7 @@ private function executeCommand(ScheduledCommand $scheduledCommand, OutputInterf $this->em->persist($scheduledCommand); $this->em->flush(); $this->em->getConnection()->commit(); - } catch (\Exception $e) { + } catch (\Throwable $e) { $this->em->getConnection()->rollBack(); $output->writeln( sprintf( @@ -238,7 +238,7 @@ private function executeCommand(ScheduledCommand $scheduledCommand, OutputInterf .' '.$scheduledCommand->getArguments().'' ); $result = $command->run($input, $logOutput); - } catch (\Exception $e) { + } catch (\Throwable $e) { $logOutput->writeln($e->getMessage()); $logOutput->writeln($e->getTraceAsString()); $result = -1;