Mercurial > piecrust2
comparison piecrust/resources/server/piecrust-debug-info.js @ 1082:8d5b8a3dca02
serve: Show debug info, report errors when debug info isn't available.
author | Ludovic Chabant <ludovic@chabant.com> |
---|---|
date | Thu, 15 Feb 2018 21:17:01 -0800 |
parents | 93b656f0af54 |
children |
comparison
equal
deleted
inserted
replaced
1081:d4e0c53aa6e8 | 1082:8d5b8a3dca02 |
---|---|
282 var xmlHttp = new XMLHttpRequest(); | 282 var xmlHttp = new XMLHttpRequest(); |
283 | 283 |
284 xmlHttp.onreadystatechange = function() { | 284 xmlHttp.onreadystatechange = function() { |
285 if (xmlHttp.readyState == XMLHttpRequest.DONE) { | 285 if (xmlHttp.readyState == XMLHttpRequest.DONE) { |
286 var info = document.querySelector('.piecrust-debug-info'); | 286 var info = document.querySelector('.piecrust-debug-info'); |
287 if(xmlHttp.status == 200) { | 287 if(xmlHttp.status < 500) { |
288 info.innerHTML = xmlHttp.responseText; | 288 info.innerHTML = xmlHttp.responseText; |
289 } | 289 } |
290 else if(xmlHttp.status == 400) { | |
291 info.innerHTML = "Error fetching debug info."; | |
292 } | |
293 else { | 290 else { |
291 console.log(xmlHttp); | |
294 info.innerHTML = "Unknown error."; | 292 info.innerHTML = "Unknown error."; |
295 } | 293 } |
296 } | 294 } |
297 } | 295 } |
298 | 296 |