8000 Redesigned the exception pages · ostrolucky/symfony@9d0c263 · GitHub
[go: up one dir, main page]

Skip to content

Commit 9d0c263

Browse files
javiereguiluzfabpot
authored andcommitted
Redesigned the exception pages
1 parent 9f95654 commit 9d0c263

30 files changed

+363
-427
lines changed
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
{% include '@Twig/Exception/error.xml.twig' %}
1+
{{ include('@Twig/Exception/error.xml.twig') }}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
{% include '@Twig/Exception/error.xml.twig' %}
1+
{{ include('@Twig/Exception/error.xml.twig') }}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
{% include '@Twig/Exception/exception.xml.twig' with { 'exception': exception } %}
1+
{{ include('@Twig/Exception/exception.xml.twig', { exception: exception }) }}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
/*
2-
{% include '@Twig/Exception/exception.txt.twig' with { 'exception': exception } %}
2+
{{ include('@Twig/Exception/exception.txt.twig', { exception: exception }) }}
33
*/
Lines changed: 77 additions & 106 deletions
Original file line numberDiff line numberDiff line change
@@ -1,120 +1,91 @@
1-
<div class="block-exception">
2-
<div class="block-exception-detected clear-fix">
3-
<div class="support">
4-
<a href="http://symfony.com/support">Need support?</a>
5-
</div>
6-
<div class="illustration-exception">
7-
{{ include('@Twig/Exception/exception.svg') }}
1+
<div class="exception-summary">
2+
<div class="exception-metadata">
3+
<div class="container">
4+
<h2 class="exception-hierarchy">
5+
{% for previousException in exception.allPrevious|reverse %}
6+
{{ previousException.class|abbr_class }}
7+
<span class="icon">{{ include('@Twig/images/chevron-right.svg') }}</span>
8+
{% endfor %}
9+
{{ exception.class|abbr_class }}
10+
</h2>
11+
<h2 class="exception-http">
12+
HTTP {{ status_code }} <small>{{ status_text }}</small>
13+
</h2>
814
</div>
9-
<div class="text-exception">
10-
<div class="open-quote">“</div>
11-
12-
<h1>{{ exception.message|nl2br|format_file_from_text }}</h1>
13-
14-
<div>
15-
<strong>{{ status_code }}</strong> {{ status_text }} - {{ exception.class|abbr_class }}
15+
</div>
16+
<div class="container">
17+
<div class="exception-message-wrapper">
18+
<h1 class="break-long-words exception-message {{ exception.message|length > 180 ? 'long' }}">
19+
{{- exception.message|nl2br|format_file_from_text -}}
20+
</h1>
21+
22+
<div class="exception-illustration hidden-xs-down">
23+
{{ include('@Twig/images/symfony-ghost.svg') }}
1624
</div>
17-
18-
{% set previous_count = exception.allPrevious|length %}
19-
{% if previous_count %}
20-
<div class="linked"><span><strong>{{ previous_count }}</strong> linked Exception{{ previous_count > 1 ? 's' : '' }}:</span>
21-
<ul>
22-
{% for i, previous in exception.allPrevious %}
23-
<li>
24-
{{ previous.class|abbr_class }} <a href="#traces-link-{{ i + 1 }}" onclick="toggle('traces-{{ i + 1 }}', 'traces'); switchIcons('icon-traces-{{ i + 1 }}-open', 'icon-traces-{{ i + 1 }}-close');">&#187;</a>
25-
</li>
26-
{% endfor %}
27-
</ul>
28-
</div>
29-
{% endif %}
30-
31-
<div class="close-quote">”</div>
3225
</div>
3326
</div>
3427
</div>
3528

36-
{% for position, e in exception.toarray %}
37-
{% include '@Twig/Exception/traces.html.twig' with { 'exception': e, 'position': position, 'count': previous_count } only %}
38-
{% endfor %}
39-
40-
{% if logger %}
41-
<div class="block">
42-
<div class="logs clear-fix">
43-
{% spaceless %}
44-
<h2>
45-
Logs&nbsp;
46-
<a href="#" onclick="toggle('logs'); switchIcons('icon-logs-open', 'icon-logs-close'); return false;">
47-
<img class="toggle" id="icon-logs-open" alt="+" src="data:image/gif;base64,R0lGODlhEgASAMQTANft99/v+Ga44bHb8ITG52S44dXs9+z1+uPx+YvK6WC24G+944/M6W28443L6dnu+Ge54v/+/l614P///wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACH5BAEAABMALAAAAAASABIAQAVS4DQBTiOd6LkwgJgeUSzHSDoNaZ4PU6FLgYBA5/vFID/DbylRGiNIZu74I0h1hNsVxbNuUV4d9SsZM2EzWe1qThVzwWFOAFCQFa1RQq6DJB4iIQA7" style="display: none" />
48-
<img class="toggle" id="icon-logs-close" alt="-" src="data:image/gif;base64,R0lGODlhEgASAMQSANft94TG57Hb8GS44ez1+mC24IvK6ePx+Wa44dXs92+942e54o3L6W2844/M6dnu+P/+/l614P///wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACH5BAEAABIALAAAAAASABIAQAVCoCQBTBOd6Kk4gJhGBCTPxysJb44K0qD/ER/wlxjmisZkMqBEBW5NHrMZmVKvv9hMVsO+hE0EoNAstEYGxG9heIhCADs=" style="display: inline" />
49-
</a>
50-
</h2>
51-
{% endspaceless %}
29+
<div class="container">
30+
<div class="sf-tabs">
7E71 31+
<div class="tab">
32+
{% set exception_as_array = exception.toarray %}
33+
<h3 class="tab-title">
34+
{% if exception_as_array|length > 1 %}
35+
Exceptions <span class="badge">{{ exception_as_array|length }}</span>
36+
{% else %}
37+
Exception
38+
{% endif %}
39+
</h3>
40+
41+
<div class="tab-content">
42+
{% for e in exception_as_array %}
43+
{{ include('@Twig/Exception/traces.html.twig', { exception: e, index: loop.index }, with_context = false) }}
44+
{% endfor %}
45+
</div>
46+
</div>
5247

53-
{% if logger.counterrors %}
54-
<div class="error-count">
55-
<span>
56-
{{ logger.counterrors }} error{{ logger.counterrors > 1 ? 's' : ''}}
57-
</span>
58-
</div>
59-
{% endif %}
48+
<div class="tab {{ logger is empty ? 'disabled' }}">
49+
<h3 class="tab-title">
50+
Logs
51+
{% if logger.counterrors ?? false %}<span class="badge status-error">{{ logger.counterrors }}</span>{% endif %}
52+
</h3>
53+
54+
<div class="tab-content">
55+
{% if logger %}
56+
{{ include('@Twig/Exception/logs.html.twig', { logs: logger.logs }, with_context = false) }}
57+
{% else %}
58+
<div class="empty">
59+
<p>No log messages</p>
60+
</div>
61+
{% endif %}
62+
</div>
6063
</div>
6164

62-
<div id="logs">
63-
{% include '@Twig/Exception/logs.html.twig' with { 'logs': logger.logs } only %}
65+
<div class="tab">
66+
<h3 class="tab-title">
67+
{% if exception_as_array|length > 1 %}
68+
Stack Traces <span class="badge">{{ exception_as_array|length }}</span>
69+
{% else %}
70+
Stack Trace
71+
{% endif %}
72+
</h3>
73+
74+
<div class="tab-content">
75+
{% for e in exception_as_array %}
76+
{{ include('@Twig/Exception/traces_text.html.twig', { exception: e, index: loop.index, num_exceptions: loop.length }, with_context = false) }}
77+
{% endfor %}
78+
</div>
6479
</div>
65-
</div>
66-
{% endif %}
6780

68-
{% if currentContent %}
69-
<div class="block">
70-
{% spaceless %}
71-
<h2>
72-
Content of the Output&nbsp;
73-
<a href="#" onclick="toggle('output-content'); switchIcons('icon-content-open', 'icon-content-close'); return false;">
74-
<img class="toggle" id="icon-content-close" alt="-" src="data:image/gif;base64,R0lGODlhEgASAMQSANft94TG57Hb8GS44ez1+mC24IvK6ePx+Wa44dXs92+942e54o3L6W2844/M6dnu+P/+/l614P///wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACH5BAEAABIALAAAAAASABIAQAVCoCQBTBOd6Kk4gJhGBCTPxysJb44K0qD/ER/wlxjmisZkMqBEBW5NHrMZmVKvv9hMVsO+hE0EoNAstEYGxG9heIhCADs=" style="display: none" />
75-
<img class="toggle" id="icon-content-open" alt="+" src="data:image/gif;base64,R0lGODlhEgASAMQTANft99/v+Ga44bHb8ITG52S44dXs9+z1+uPx+YvK6WC24G+944/M6W28443L6dnu+Ge54v/+/l614P///wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACH5BAEAABMALAAAAAASABIAQAVS4DQBTiOd6LkwgJgeUSzHSDoNaZ4PU6FLgYBA5/vFID/DbylRGiNIZu74I0h1hNsVxbNuUV4d9SsZM2EzWe1qThVzwWFOAFCQFa1RQq6DJB4iIQA7" style="display: inline" />
76-
</a>
77-
</h2>
78-
{% endspaceless %}
81+
{% if currentContent is not empty %}
82+
<div class="tab">
83+
<h3 class="tab-title">Output content</h3>
7984

80-
<div id="output-content" style="display: none">
81-
{{ currentContent }}
85+
<div class="tab-content">
86+
{{ currentContent }}
87+
</div>
8288
</div>
83-
84-
<div style="clear: both"></div>
89+
{% endif %}
8590
</div>
86-
{% endif %}
87-
88-
{% include '@Twig/Exception/traces_text.html.twig' with { 'exception': exception } only %}
89-
90-
<script type="text/javascript">//<![CDATA[
91-
function toggle(id, clazz) {
92-
var el = document.getElementById(id),
93-
current = el.style.display,
94-
i;
95-
96-
if (clazz) {
97-
var tags = document.getElementsByTagName('*');
98-
for (i = tags.length - 1; i >= 0; i--) {
99-
if (tags[i].className === clazz) {
100-
tags[i].style.display = 'none';
101-
}
102-
}
103-
}
104-
105-
el.style.display = current === 'none' ? 'block' : 'none';
106-
}
107-
108-
function switchIcons(id1, id2) {
109-
var icon1, icon2, display1, display2;
110-
111-
icon1 = document.getElementById(id1);
112-
icon2 = document.getElementById(id2);
113-
114-
display1 = icon1.style.display;
115-
display2 = icon2.style.display;
116-
117-
icon1.style.display = display2;
118-
icon2.style.display = display1;
119-
}
120-
//]]></script>
91+
</div>
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
/*
2-
{% include '@Twig/Exception/exception.txt.twig' with { 'exception': exception } %}
2+
{{ include('@Twig/Exception/exception.txt.twig', { exception: exception }) }}
33
*/
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
{% include '@Twig/Exception/exception.xml.twig' with { 'exception': exception } %}
1+
{{ include('@Twig/Exception/exception.xml.twig', { exception: exception }) }}

src/Symfony/Bundle/TwigBundle/Resources/views/Exception/exception.svg

Lines changed: 0 additions & 7 deletions
This file was deleted.

src/Symfony/Bundle/TwigBundle/Resources/views/Exception/exception.txt.twig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@
22
[message] {{ exception.message }}
33
{% for i, e in exception.toarray %}
44
[{{ i + 1 }}] {{ e.class }}: {{ e.message }}
5-
{% include '@Twig/Exception/traces.txt.twig' with { 'exception': e } only %}
5+
{{ include('@Twig/Exception/traces.txt.twig', { exception: e }, with_context = false) }}
66

77
{% endfor %}

src/Symfony/Bundle/TwigBundle/Resources/views/Exception/exception.xml.twig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<error code="{{ status_code }}" message="{{ status_text }}">
44
{% for e in exception.toarray %}
55
<exception class="{{ e.class }}" message="{{ e.message }}">
6-
{% include '@Twig/Exception/traces.xml.twig' with { 'exception': e } only %}
6+
{{ include('@Twig/Exception/traces.xml.twig', { exception: e }, with_context = false) }}
77
</exception>
88
{% endfor %}
99
</error>
Lines changed: 26 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,28 @@
1-
<ol class="traces logs">
1+
{% set channel_is_defined = (logs|first).channel is defined %}
2+
3+
<table class="logs">
4+
<thead>
5+
<tr>
6+
<th>Level</th>
7+
{% if channel_is_defined %}<th>Channel</th>{% endif %}
8+
<th class="full-width">Message</th>
9+
</tr>
10+
</thead>
11+
12+
<tbody>
213
{% for log in logs %}
3-
<li{% if log.priority >= 400 %} class="error"{% elseif log.priority >= 300 %} class="warning"{% endif %}>
4-
{{ log.priorityName }} - {{ log.message|format_log_message(log.context) }}
5-
</li>
14+
<tr class="status-{{ log.priority >= 400 ? 'error' : log.priority >= 300 ? 'warning' : 'normal' }}">
15+
<td class="text-small" nowrap>
16+
<span class="colored text-bold">{{ log.priorityName }}</span>
17+
<span class="text-muted newline">{{ log.timestamp|date('H:i:s') }}</span>
18+
</td>
19+
{% if channel_is_defined %}
20+
<td class="text-small text-bold nowrap">
21+
{{ log.channel }}
22+
</td>
23+
{% endif %}
24+
<td>{{ log.message }}</td>
25+
</tr>
626
{% endfor %}
7-
</ol>
27+
</tbody>
28+
</table>

0 commit comments

Comments
 (0)
0