Skip to content

Errors during console presenter/application startup get silenced #81

@redwormik

Description

@redwormik

Hi,

the DI extension exits the application on error, silencing default error handler as the console application formats the errors better. (

if (PHP_SAPI === ConsoleApplication::CLI_SAPI) {
,
$this->handleException($e, $output);
).

BUT if creation of console presenter / application fails (for example, when I misconfigured some service that gets used in injectPrimary of Nette\Application\UI\Presenter), the Nette application simply quits, because the console application does not run at all and there is no output at all.

I guess the solution would be to setup the Nette application onError handler in the CliPresenter, directly before it calls $this->console->run, would that be OK? Am I missing the point of setting the onError so early?

I would gladly prepare the PR if this or other solution is approved.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions