Skip to content

Commit f7de083

Browse files
committed
bug #23266 Display a better error message when the toolbar cannot be displayed (javiereguiluz)
This PR was merged into the 2.7 branch. Discussion ---------- Display a better error message when the toolbar cannot be displayed | Q | A | ------------- | --- | Branch? | 2.7 | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | #23264 | License | MIT | Doc PR | - In action: ![profiler-error](https://user-images.githubusercontent.com/73419/27444352-5d0a1d60-5776-11e7-89c3-430cd6f38454.png) Commits ------- cc7275b Display a better error message when the toolbar cannot be displayed
2 parents a66b967 + cc7275b commit f7de083

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)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy