From 3e456f46a65d098c271106ed70c0b10c9fb3d964 Mon Sep 17 00:00:00 2001 From: John MacFarlane <jgm@berkeley.edu> Date: Thu, 18 Aug 2022 18:20:16 -0700 Subject: [PATCH] Minor changes to trypandoc js. --- trypandoc/index.html | 2 +- trypandoc/trypandoc.js | 14 ++++---------- 2 files changed, 5 insertions(+), 11 deletions(-) diff --git a/trypandoc/index.html b/trypandoc/index.html index 8ef140de2..33006f4f8 100644 --- a/trypandoc/index.html +++ b/trypandoc/index.html @@ -175,7 +175,7 @@ <p class="version">pandoc version <span id="version"></span></p> </footer> -<script src="trypandoc.js"></script> +<script src="trypandoc.js?202208181818"></script> </body> </html> diff --git a/trypandoc/trypandoc.js b/trypandoc/trypandoc.js index 8d34c338b..612ed5ac8 100644 --- a/trypandoc/trypandoc.js +++ b/trypandoc/trypandoc.js @@ -52,14 +52,10 @@ function paramsFromURL() { } function handleErrors(response) { - if (!response.ok) { - throw Error(response.statusText); - } - if (response.status == 300) { + if (response.status == 503) { throw Error("Conversion timed out.") - } - if (response.status != 200) { - throw Error("Server returned status " + response.status.toString()) + } else if (!response.ok) { + throw Error(response.statusText); } return response; } @@ -77,9 +73,7 @@ function convert() { fetch("/cgi-bin/pandoc-server.cgi/version") .then(handleErrors) .catch(error => - document.getElementById("results").textContent = error; - return Promise.reject(); - ) + document.getElementById("results").textContent = error ) .then(response => response.text()) .then(restext => document.getElementById("version").textContent = restext