Skip to content
This repository has been archived by the owner on Jan 8, 2020. It is now read-only.

[Console] ViewManager hides exceptions in console #6866

Closed
Thinkscape opened this issue Nov 13, 2014 · 11 comments
Closed

[Console] ViewManager hides exceptions in console #6866

Thinkscape opened this issue Nov 13, 2014 · 11 comments
Assignees
Milestone

Comments

@Thinkscape
Copy link
Member

This is what bugs me very often:
image

Because in production we'll usually see:

    'view_manager' => [
        'display_not_found_reason' => false,
        'display_exceptions'       => false,
    ],

... it will also affect console rendering of exceptions. It's not easily solvable when using config caching, because tricks like conditionals in config files are uncacheable.

I see couple of solutions:

  1. Ignore this setting when running in console (under the assumption that we always want to see exceptions in console as it's a protected environment)
  2. Separate the setting, i.e. add display_exceptions_console.
@Thinkscape
Copy link
Member Author

I welcome your thoughts on that. Meanwhile, here's a dirty workaround:

    public function onBootstrap(MvcEvent $e)
    {
        $sm = $e->getApplication()->getServiceManager();

        // Fix exceptions not displaying in console
        if (Console::isConsole()) {
            /** @var ViewManager $vm */
            $vm = $sm->get('ViewManager');
            $vm->getExceptionStrategy()->setDisplayExceptions(true);
        }
    }

@veewee
Copy link
Contributor

veewee commented Nov 13, 2014

+1

@gianarb
Copy link
Contributor

gianarb commented Nov 13, 2014

Separate the setting, i.e. add display_exceptions_console.

I'm for this solution

@texdc
Copy link
Contributor

texdc commented Nov 13, 2014

What about console-specific configs with console or console-view?

'console' => [
    'display_not_found_reason' => true,
    'display_exceptions'       => true,
],

@jeremiahsmall
Copy link
Contributor

+1 for @texdc idea, except maybe should be all view_manager options in the same manner that we have router overrides for console.

'console' => [
    'router' => [
        // …stuff
    ],
    'view_manager' => [
        'display_not_found_reason' => true,
        'display_exceptions'       => true,
    ]
]

@Thinkscape
Copy link
Member Author

@texdc The actual implementation sits in a console-specific ViewManager, which is very similar to standard http ViewManager so I want to keep it consistent.

That means, that @jeremiahsmall is on the money with how we should probably nest it (which is in-line with how we nest console router config)

@weierophinney as you're the original ViewManager author, do you have anything against me separating those ViewManager configs?

@texdc
Copy link
Contributor

texdc commented Nov 14, 2014

@Thinkscape @jeremiahsmall 👍 nested is fine with me.

@macnibblet
Copy link
Contributor

👍 I have found this issue to be a pain in the ******

@weierophinney
Copy link
Member

@Thinkscape separating configs based on context makes a ton of sense to me.

@Ocramius
Copy link
Member

Handled in #6951

@macnibblet
Copy link
Contributor

Le awesome!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

8 participants