netgen-layouts / layouts-core

Netgen Layouts enables you to build and manage complex web pages in a simpler way and with less coding. This is the core of Netgen Layouts, its heart and soul.
https://netgen.io/layouts
MIT License
36 stars 6 forks source link

Rendering backend exceptions and Twig errors in debug mode #29

Closed weaverryan closed 1 year ago

weaverryan commented 2 years ago

Hi!

This is just an idea. I think it's actually 2 separate (but related things). Both relate to what happens when you make a coding mistake, and the result is that something "doesn't work" while in the layouts admin.

A) If any Ajax call fails with a 500 error, it'd be cool (in debug mode at least) to render the full exception in a modal. I did this recently - you could re-use the code: https://github.com/symfony/ux/pull/467

B) In some cases, if you have an error in Twig, the error is hidden entirely. I think this is to avoid error in production from a user error. But, for example, when creating the "preview" template for a content browser, any mistake I made in that Twig template wasn't shown to me. It'd be awesome to ALLOW the error to be thrown in debug mode and, along with (A), show it to the user.

Cheers!

emodric commented 2 years ago

Hi @weaverryan

I remembered that we actually had this feature from the start, but due to a bug which I investigated today, it did not show up.

The error popup looks like this:

image

This still does not solve the content browser preview issue. I will try to implement your suggestion with the popup there.

Thanks!

weaverryan commented 2 years ago

I started seeing this and I really like it. Thanks!

emodric commented 1 year ago

Closing as this is now working again in Layouts!