Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 6f9d0f0

Browse files
committed
feature #31514 Add exception as HTML comment to beginning and end of exception_full.html.twig (ruudk)
This PR was merged into the 4.4 branch. Discussion ---------- Add exception as HTML comment to beginning and end of `exception_full.html.twig` | Q | A | ------------- | --- | Branch? | master | Bug fix? | no | New feature? | yes | BC breaks? | no | Tests pass? | yes | License | MIT ## Description Every now and then you are confronted with an exception in Symfony's debug mode. Sometimes, you will see this in your browser console or terminal. To make it easier to easily see what's going on, this change adds a HTML comment on 2 locations: - between the `<html>` and `<head>` tag; - between the `</body>` and `</html>` tag. This way, you don't have to scan the very verbose HTML that Symfony generates. You can quickly glance at the end or the beginning. ## How does it look? ```html <!-- Notice: Undefined index: payouts in /Volumes/CS/www/src/Generated/GraphQL/Query/TransactionList/Data.php line 33 (500 Internal Server Error) --> <html> <head> <meta charset="UTF-8"> <meta name="robots" content="noindex,nofollow"> <meta name="viewport" content="width=device-width,initial-scale=1"> <title> Notice: Undefined index: payouts in /Volumes/CS/www/src/Generated/GraphQL/Query/TransactionList/Data.php line 33 (500 Internal Server Error) </title> <link rel="icon" type="image/png" href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABwAAAAgCAYAAAABtRhCAAADVUlEQVRIx82XX0jTURTHLYPyqZdefQx66CEo80+aYpoIkqzUikz6Z5klQoWUWYRIJYEUGpQ+lIr9U5dOTLdCtkmWZis3rbnC5fw/neYW002307mX/cZvP3/7o1PwwOdh95x7vnf39zvnd29AgBer2xO6DclAXiMqZAqxIiNIN/IYSUS2BPhjmGATchUxI+ADWiRhpWK7HKuHFVBFdmU5YvnI4grFGCaReF/EBH4KsZlGgj2JBTuCYBWRIYF8YoEOJ6wBt/gEs7mBbyOjQXruPLSdOgPCiEiPSUUHDoL8Ug5IUo9B/d5wrt+G7OAKNrODPuVdB6vRCIzN6SdBlpW9RIgk/1FeAXabzRlrUPVCS/JhbmwudztnGeeH9AyXBIwtmM3wLinZJZHifjHw2V+NBoRh+9ixQrbgbnaSIcl7cGea6hoXQbNe7za241oeO5Z0p42M4BV2EqP2D50wo+6HzvwC6C4sApNOR8cmOrtcnhtj2kYRyC9eBvXzKrBZrXSs72kFd1t3MoKVbMekQkEnSNKOO8fac3LpmK6l1TlGtsxmsdKFsecPYgwxst0cwROMYDXboSotg0WLBRqjY51jLYcENElXwW2XJKPydvoI2GN9T8rBtrAArYIUruBJXkFheCQYlCpQP6uk5dAQFQNaUROMSGVQFxLmkoQsxDJrhLbTZ+nvVsERME9MgPJRKV/58AsyomTSzE813WLFvWK++qI0xSfQl8k8Pg46sYRuv5t6dS+4RqxDwaa4BGjYH+NTQvKScIp9+YL/hoZh3jDtLRHtt2C3g6bmhX+CpsFBWg7ilDSPgj0lD2ncr5ev/BP8VvyAJhqVyZeUhPOrEhEFxgEtjft846Z/guQTNT89Q5P9flMLoth4F7808wKtWWKzAwNQHxrh/1vaid2F+XpYTSbQf1XA2McOmOpROnvpvMEA4tSjq1cW0sws2gCYxswY6TKkvzYnJq1NHZLnRU4BX+4U0uburvusu8Kv8iHY7qefkM4IFngJHEOUXmLEPgiGsI8YnlZILit3vSSLRTQe/MPIZva5pshNIEmyFQlCvruJKXPkCEfmePzkphXHdzZNQdoRI9KPlBAxlj/I8U97ERPS5bjGbWDFbEdqHVe5caTBeZZx2H/IMvzeN15yoQAAAABJRU5ErkJggg==%0A"> <!-- ... clip ... --> Sfjs.addEventListener(document, 'DOMContentLoaded', function() { Sfjs.createTabs(); Sfjs.createToggles(); Sfjs.createFilters(); }); /*]]>*/</script> </body> </html> <!-- Notice: Undefined index: payouts in /Volumes/CS/www/src/Generated/GraphQL/Query/TransactionList/Data.php line 33 (500 Internal Server Error) --> ``` Commits ------- 11c8b45 Add exception as HTML comment to beginning and end of `exception_full.html.twig`
2 parents 05d6d31 + 11c8b45 commit 6f9d0f0

File tree

3 files changed

+11
-0
lines changed

3 files changed

+11
-0
lines changed

src/Symfony/Bundle/TwigBundle/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ CHANGELOG
55
-----
66

77
* marked the `TemplateIterator` as `internal`
8+
* added HTML comment to beginning and end of `exception_full.html.twig`
89

910
4.2.0
1011
-----

src/Symfony/Bundle/TwigBundle/Resources/views/Exception/exception_full.html.twig

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,14 @@
137137
{{ exception.message }} ({{ status_code }} {{ status_text }})
138138
{% endblock %}
139139

140+
{% block before_html %}
141+
<!-- {{ exception.message }} ({{ status_code }} {{ status_text }}) -->
142+
{% endblock %}
143+
144+
{% block after_html %}
145+
<!-- {{ exception.message }} ({{ status_code }} {{ status_text }}) -->
146+
{% endblock %}
147+
140148
{% block body %}
141149
{% include '@Twig/Exception/exception.html.twig' %}
142150
{% endblock %}

src/Symfony/Bundle/TwigBundle/Resources/views/layout.html.twig

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
{% block before_html %}{% endblock %}
12
<!DOCTYPE html>
23
<html>
34
<head>
@@ -34,3 +35,4 @@
3435
{{ include('@Twig/base_js.html.twig') }}
3536
</body>
3637
</html>
38+
{% block after_html %}{% endblock %}

0 commit comments

Comments
 (0)