Skip to content

Commit

Permalink
ApplicationExtension: $catchExceptions can be '4xx' in addition to bool
Browse files Browse the repository at this point in the history
  • Loading branch information
dg committed Mar 11, 2024
1 parent 3f48f8e commit d16847f
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/Bridges/ApplicationDI/ApplicationExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public function getConfigSchema(): Nette\Schema\Schema
])->castTo('array'),
Expect::string()->dynamic(),
)->firstIsDefault(),
'catchExceptions' => Expect::bool(false)->dynamic(),
'catchExceptions' => Expect::anyOf('4xx', true, false)->firstIsDefault()->dynamic(),
'mapping' => Expect::anyOf(
Expect::string(),
Expect::arrayOf('string|array'),
Expand Down Expand Up @@ -77,6 +77,8 @@ public function loadConfiguration(): void
->setFactory(Nette\Application\Application::class);
if ($config->catchExceptions || !$this->debugMode) {
$application->addSetup('$error4xxPresenter', [is_array($config->errorPresenter) ? $config->errorPresenter['4xx'] : $config->errorPresenter]);
}
if ($config->catchExceptions === true || !$this->debugMode) {
$application->addSetup('$errorPresenter', [is_array($config->errorPresenter) ? $config->errorPresenter['5xx'] : $config->errorPresenter]);
}

Expand Down

0 comments on commit d16847f

Please sign in to comment.