From 4b9b4246db6f32de732de0a3cfb7cd7b9c6c461a Mon Sep 17 00:00:00 2001 From: Stephan de Souza Date: Tue, 2 Apr 2019 09:23:08 -0300 Subject: [PATCH] Convert Error to ErrorException on SeedCommand Fixes the \Throwable mess on Laravel report --- src/Commands/SeedCommand.php | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/src/Commands/SeedCommand.php b/src/Commands/SeedCommand.php index 4f7343f47..65d457abe 100644 --- a/src/Commands/SeedCommand.php +++ b/src/Commands/SeedCommand.php @@ -46,7 +46,14 @@ public function handle() array_walk($modules, [$this, 'moduleSeed']); $this->info('All modules seeded.'); } - } catch (\Throwable $e) { + } catch (\Error $e) { + $e = new \ErrorException($e->getMessage(), $e->getCode(), 1, $e->getFile(), $e->getLine(), $e); + $this->reportException($e); + + $this->renderException($this->getOutput(), $e); + + return 1; + } catch (\Exception $e) { $this->reportException($e); $this->renderException($this->getOutput(), $e); @@ -192,10 +199,10 @@ public function getSeederNames($name) * Report the exception to the exception handler. * * @param \Symfony\Component\Console\Output\OutputInterface $output - * @param \Throwable $e + * @param \Exception $e * @return void */ - protected function renderException($output, \Throwable $e) + protected function renderException($output, \Exception $e) { $this->laravel[ExceptionHandler::class]->renderForConsole($output, $e); } @@ -203,10 +210,10 @@ protected function renderException($output, \Throwable $e) /** * Report the exception to the exception handler. * - * @param \Throwable $e + * @param \Exception $e * @return void */ - protected function reportException(\Throwable $e) + protected function reportException(\Exception $e) { $this->laravel[ExceptionHandler::class]->report($e); }