Panic template execution errors to show error pages accordingly

This PR will help show error page when an error occurs during template rendering.