Developer forum

Forum » Templates » Avoid "Error compiling template" never to be shown

Avoid "Error compiling template" never to be shown

Morten
Reply

How can i avoid the "Error compiling template" to be shown with a global setting and without using try/catch on the tempalte?

Anyone?


Replies

 
Morten Bengtson Dynamicweb Employee
Morten Bengtson
Reply
This post has been marked as an answer

Hi Morten,

You can't disable these messages. Compilation errors should not be ignored, because they can make your site very unstable.

But you can hide the error messages using CSS:

.dw-error { display:none !important; }

BR Morten

Votes for this answer: 1
 
Morten S. Hvid
Reply

Hi Morten,

Thank you for your reply. Yes the compilations errors are important ;)
I'll make a 500-error setup, dealing with the compilations. This will "hide" the .dw-error from the end-user.

/Morten

 
Imar Spaanjaars Dynamicweb Employee
Imar Spaanjaars
Reply

>> Compilation errors should not be ignored, because they can make your site very unstable.

Very true. But I also think that errors should not be shown to end-users for UX and security reasons. Having a way to intercept errors (a subscriber maybe) and then log the error and show the user a friendly error message instead would be a great solution to have our cake and eat it too....

Imar

 
Morten
Reply

Spot on Imar... ;)
I would be really nice to hide the errors for the end-users, and just log the bug ...
Unfortunally I was not able to setup a friendly 500-error in DW. And I was not able to get a simple try/catch to do the trick either... :/
A subscriber would be nice - and I guess Im not the only one with this issue: https://www.google.dk/search?q="Dynamicweb"+"Error+compiling+template".

 

 
Morten Bengtson Dynamicweb Employee
Morten Bengtson
Reply

Hi guys,

Thanks for the input.

Right now we handle other errors in a similar way, e.g. when an exception is thrown inside a content module.
I do agree that we can improve this a lot and make it more friendly and easier to work with. It's definitely something that we will consider for a future release.
Let us know if you have other suggestions for improved error handling.

BR Morten

 
Jóhann Kristþórsson
Reply

Hi

 

We are having the same issue, having the stack trace appear on the frontend by default, without any way to stop it from rendering is a major security concern.

Display:none on the element is not an adequate solution since the error is still rendered to source HTML.

Could you please give this some priority since this issue is being flagged when our websites are being audited for security.

 

Regards

Jóhann

 
Jan Sangill
Reply

Hi all.

This is something that really should be looked at.

Exposing errors to end users is not good. 

I could do some logic myself in a subscriber that handles this - but I think this should be done natively via DW.

Can someone update me if there is something in progress here or maybe will be later - so I can advice my clients if we should come up with a solution or if DW will handle it.

//jan

 
Nicolai Pedersen
Reply

Hi Jan

In settings, security you can activate that Dynamicweb throws a real exception for modules and templates - see dump.

Then in your web.config or in IIS in your production environment, you can setup a 500 handler that does not expose the exception (which is usually default if you are not on the local machine).

All exceptions are logged to the event viewer already - and you can get a notification by mail when it happens. See this: https://doc.dynamicweb.com/documentation-9/monitoring#sideNavTitle1-4

I will be happy to consider a new setting that will simply display something like "An error occured in template - detailed information can be found in the log" where you see the template exception to day - and then you need to find the exception in the event viewer.

What would you guys find a viable solution?

BR Nicolai

Capture.PNG
 
Adrian Ursu Dynamicweb Employee
Adrian Ursu
Reply

Hi Nicolai,

Your suggestion sounds good to me.

Adrian

 
Nicolai Pedersen
Reply

Alright - new feature coming up in 9.8, TFS#73968

See dump

Capture.PNG
 
Jan Sangill
Reply

Hi Nikolai,

Perfect. 

 
Lars Larsen
Lars Larsen
Reply

Would be more than perfect if it was possible to select a page in the pagetree in the same way you set a 404 page wink

 

You must be logged in to post in the forum