Skip to content

Commit cc7275b

Browse files
committed
Display a better error message when the toolbar cannot be displayed
1 parent 7cc97b6 commit cc7275b

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/toolbar_js.html.twig

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,17 @@
5757
}
5858
},
5959
function(xhr) {
60+
var errorToolbarHtml = '
61+
<style>
62+
.sfErrorToolbar { background: #222; bottom: 0; color: #f5f5f5; font: 13px/36px Arial, sans-serif; height: 36px; padding: 0 15px; position: fixed; width: 100%; }
63+
.sfErrorToolbar a { color: #99cdd8; margin-left: 5px; text-decoration: underline; }
64+
.sfErrorToolbar a:hover { text-decoration: none; }
65+
</style>
66+
<div class="sfErrorToolbar">An error occurred while loading the web debug toolbar. <a href="{{ path("_profiler", { "token": token }) }}">Open the web profiler.</a></div>
67+
';
68+
6069
if (xhr.status !== 0) {
61-
confirm('An error occurred while loading the web debug toolbar (' + xhr.status + ': ' + xhr.statusText + ').\n\nDo you want to open the profiler?') && (window.location = '{{ path("_profiler", { "token": token }) }}');
70+
window.document.body.insertAdjacentHTML('beforeend', errorToolbarHtml);
6271
}
6372
},
6473
{'maxTries': 5}

0 commit comments

Comments
 (0)