Skip to content

Commit

Permalink
Fix exceptions handling with aplication option set to false
Browse files Browse the repository at this point in the history
  • Loading branch information
enumag committed Sep 21, 2016
1 parent b6ab544 commit 2451e93
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
9 changes: 5 additions & 4 deletions src/Kdyby/Console/Application.php
Original file line number Diff line number Diff line change
Expand Up @@ -137,11 +137,12 @@ public function run(InputInterface $input = NULL, OutputInterface $output = NULL
Debugger::log($e->getMessage(), Debugger::ERROR);
return self::INPUT_ERROR_EXIT_CODE;

} elseif ($app = $this->serviceLocator->getByType('Nette\Application\Application', FALSE)) {
/** @var Nette\Application\Application $app */
$app->onError($app, $e);

} else {
if ($app = $this->serviceLocator->getByType('Nette\Application\Application', FALSE)) {
/** @var Nette\Application\Application $app */
$app->onError($app, $e);
}

$this->handleException($e, $output);
}

Expand Down
3 changes: 1 addition & 2 deletions src/Kdyby/Console/DI/ConsoleExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -188,8 +188,7 @@ protected function beforeCompileHookApplication(array $config)
->addSetup('$self = $this; $service->onError[] = function ($app, $e) use ($self) {' . "\n" .
"\t" . '$app->errorPresenter = ?;' . "\n" .
"\t" . '$app->onShutdown[] = function () { exit(?); };' . "\n" .
"\t" . '$self->getService(?)->handleException($e); ' . "\n" .
'}', [FALSE, 254, $this->prefix('application')]);
'}', [FALSE, 254]);
}

$routerServiceName = $builder->getByType('Nette\Application\IRouter') ?: 'router';
Expand Down

0 comments on commit 2451e93

Please sign in to comment.