public static function handle(\Exception $ex) { if ($ex->getPrevious() instanceof ConsoleException) { Console::error($ex->getMessage()); return; } $handles = Settings::load('exception'); if (isset($handles) && !empty($handles)) { foreach ($handles as $key => $value) { if (self::recursive($ex, $key)) { if (is_callable($value)) { call_user_func($value, $ex); return; } else { /** @var ExceptionHandle $handle */ $handle = DI::get($value); if (isset($handle)) { $handle->handle(); return; } } } } } throw $ex; }
public function handle() { $command = ModelCommandExecutor::make($this->args); if (!isset($command)) { Console::error('Invalid arguments.'); return; } $command->handle(); }