From cc7275bccce951d1d6a509f52723657b572d0083 Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Thu, 22 Jun 2017 18:11:34 +0200 Subject: [PATCH] Display a better error message when the toolbar cannot be displayed --- .../Resources/views/Profiler/toolbar_js.html.twig | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/toolbar_js.html.twig b/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/toolbar_js.html.twig index 91ad9ad10e..57537f61a3 100644 --- a/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/toolbar_js.html.twig +++ b/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/toolbar_js.html.twig @@ -57,8 +57,17 @@ } }, function(xhr) { + var errorToolbarHtml = ' + +
An error occurred while loading the web debug toolbar. Open the web profiler.
+ '; + if (xhr.status !== 0) { - 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 }) }}'); + window.document.body.insertAdjacentHTML('beforeend', errorToolbarHtml); } }, {'maxTries': 5}