Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ExceptionRender] - Outputting web exceptions in CLI #130

Open
cnizzardini opened this issue Dec 8, 2022 · 2 comments
Open

[ExceptionRender] - Outputting web exceptions in CLI #130

cnizzardini opened this issue Dec 8, 2022 · 2 comments
Labels
bug Something isn't working
Milestone

Comments

@cnizzardini
Copy link
Member

What Happened

Web exceptions (html) output to CLI when an exception is encountered running a command.

Expected Behavior

CLI exceptions are displayed.

Steps to Reproduce

  1. Throw an exception in a cake command

Proposed change:

    public function render(): ResponseInterface
    {
        if (PHP_SAPI === 'cli') {
            $request = $request ?? Router::getRequest();
            return (new ConsoleExceptionRenderer($this->error, $request, $this->_config))->render();
        }
    }
@cnizzardini cnizzardini added the bug Something isn't working label Dec 8, 2022
@cnizzardini cnizzardini added this to the v1.2.0 milestone Dec 8, 2022
@cnizzardini
Copy link
Member Author

cnizzardini commented Dec 8, 2022

Work around in app/config.php:

'exceptionRenderer' => PHP_SAPI !== 'cli' ? MixerApiExceptionRenderer::class : null,

@jamisonbryant
Copy link

jamisonbryant commented Dec 20, 2022

Work around in app/config.php

This is the exact workaround I found and ended up using ages ago, I'm sorry I didn't not realize it was a defect and share it sooner. I suppose it should have been obvious with all the markup in the CLI.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants