CodeIgniter Forums
Spark db:seed - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: CodeIgniter 4 (https://forum.codeigniter.com/forumdisplay.php?fid=28)
+--- Forum: CodeIgniter 4 Discussion (https://forum.codeigniter.com/forumdisplay.php?fid=31)
+--- Thread: Spark db:seed (/showthread.php?tid=82881)



Spark db:seed - iRedds - 08-29-2022

If you call the php spark db:seed command on a file that does not exist, an exception is thrown (For what?) and, along with the error text, a backtrace is also displayed.
It seems to me that such behavior in the console looks terrible.

Code:
php spark db:seed 11

CodeIgniter v4.2.5 Command Line Tool - Server Time: 2022-08-29 19:49:44 UTC-05:00


[InvalidArgumentException]

The specified seeder is not a valid file: D:\dev\CodeIgniter4\app\Database/Seeds/11.php

at SYSTEMPATH\Database\Seeder.php:130

Backtrace:
  1    SYSTEMPATH\Commands\Database\Seed.php:77
      CodeIgniter\Database\Seeder()->call()

  2    SYSTEMPATH\CLI\Commands.php:63
      CodeIgniter\Commands\Database\Seed()->run()

  3    SYSTEMPATH\CLI\CommandRunner.php:65
      CodeIgniter\CLI\Commands()->run()

  4    SYSTEMPATH\CLI\CommandRunner.php:51
      CodeIgniter\CLI\CommandRunner()->index()

  5    SYSTEMPATH\CodeIgniter.php:897
      CodeIgniter\CLI\CommandRunner()->_remap()

  6    SYSTEMPATH\CodeIgniter.php:457
      CodeIgniter\CodeIgniter()->runController()

  7    SYSTEMPATH\CodeIgniter.php:336
      CodeIgniter\CodeIgniter()->handleRequest()

  8    SYSTEMPATH\CLI\Console.php:48
      CodeIgniter\CodeIgniter()->run()

  9    ROOTPATH\spark:98
      CodeIgniter\CLI\Console()->run()



RE: Spark db:seed - MGatner - 09-04-2022

That would be a good candidate for an exception catch and a custom error output, for sure. Nice "catch" Wink