From: Ian Jackson Date: Tue, 23 Jun 2020 19:40:13 +0000 (+0100) Subject: client lookup for /_/updates, error handling X-Git-Tag: otter-0.2.0~1562 X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=commitdiff_plain;h=ce34e92c7a50f1f9532924e3e118819443bb88da;p=otter.git client lookup for /_/updates, error handling --- diff --git a/templates/script.js b/templates/script.js index 0fbdd3e2..96034fa5 100644 --- a/templates/script.js +++ b/templates/script.js @@ -20,10 +20,14 @@ function xhr_post_then(url,data,good) { } function xhr_report_error(xhr) { - let error_message = JSON.stringify({ + json_report_error({ statusText : xhr.statusText, responseText : xhr.responseText, }); +} + +function json_report_error(error_json) { + let error_message = JSON.stringify(error_json); let errornode = document.getElementById('error'); errornode.textContent = 'Error (reloading may help?):' + error_message; } @@ -97,6 +101,15 @@ function startup() { var k = Object.keys(j)[0]; messages[k](j[k]); } + es.onerror = function(e) { + console.log('FOO',e,es); + json_report_error({ + updates_error : e, + updates_event_source : es, + updates_event_source_ready : es.readyState, + update_oe : e.className, + }) + } } function doload(){ diff --git a/templates/test.tera b/templates/test.tera index d03e8d43..e8eef9b0 100644 --- a/templates/test.tera +++ b/templates/test.tera @@ -1,6 +1,7 @@

Hi!

- +
+

nothing