diff --git a/client-src/base/results.css b/client-src/base/results.css
index bcbc850b..f8972ebd 100644
--- a/client-src/base/results.css
+++ b/client-src/base/results.css
@@ -16,3 +16,7 @@
height: 3rem;
font-size: 2rem;
}
+
+.task-status {
+ font-size: small;
+}
diff --git a/client-src/shared/poll/poll.js b/client-src/shared/poll/poll.js
index 02b00a51..461e0883 100644
--- a/client-src/shared/poll/poll.js
+++ b/client-src/shared/poll/poll.js
@@ -1,20 +1,26 @@
import { PollUntilValid } from "./pollUntilValid.js";
-import { setDownloadLink, setIsBusy, setDisabled } from "../domHelpers.js";
+import {
+ setDownloadLink,
+ setIsBusy,
+ setDisabled,
+ setTaskStatus,
+} from "../domHelpers.js";
/**
* This function polls repeatedly data from a URL as long as it receives
* HTTP 202 Accepted Codes.
- * It will stop if it get a 200 OK or any Code outside the range of 200-299.
- * Depending on Success(200), Pending(202), or any failure (!200-299 or NetworkError) it
+ * It will stop if it gets a 200 OK or any Code outside the range of 200-299.
+ * Depending on Success(200), Pending(202), or any failure (!200-299) it
* will display different messages to the user.
+ * On NetworkError it will continue polling.
*
* The function assumes the availability of 2 HTML Elements with the following ids:
* @example
*
*
*
- * @param downloadUrl
- * @param prefix
+ * @param url url to poll from
+ * @param prefix identifier used to decide where results or progress messages should be displayed
* @returns {Promise
+ There was an Internal Server Error.`);
+ } else {
+ handleError(prefix, `${new Date().toISOString()} ${taskStatus}
${errorText}`);
+ }
+ // remove task status
+ setTaskStatus(`${prefix}-status`, "");
}
try {
return await PollUntilValid.poll(url, validateFn, 1000, onValid, onProgress, onError);
- } catch (e) {
- // Network Error or other reason why the request could not be completed
- console.log(e);
- handleError(prefix, e);
- return null;
+ } catch (error) {
+ if (error instanceof TypeError) {
+ // Chrome and Firefox use different Error messages, so it's hard to be more
+ // specific than checking for TypeError
+ // see: https://developer.mozilla.org/en-US/docs/Web/API/fetch#exceptions
+ setTaskStatus(`${prefix}-status`, "NetworkError: RETRYING to get task status");
+ await PollUntilValid.wait(5000);
+ return poll(url, prefix);
+ }
+ throw error;
}
}
diff --git a/client-src/shared/poll/pollUntilValid.js b/client-src/shared/poll/pollUntilValid.js
index 40adac04..86d9f5bc 100644
--- a/client-src/shared/poll/pollUntilValid.js
+++ b/client-src/shared/poll/pollUntilValid.js
@@ -27,24 +27,8 @@ class PollUntilValid {
onError = () => {},
) {
do {
- let response;
- try {
- /* eslint-disable no-await-in-loop */
- response = await fetch(url);
- } catch (error) {
- if (error instanceof TypeError) {
- // Chrome and Firefox use different Error messages, so it's hard to be more
- // specific than checking for TypeError
- // see: https://developer.mozilla.org/en-US/docs/Web/API/fetch#exceptions
- console.log("NetworkError, continue retrying", error);
- await PollUntilValid.wait(5000);
- } else {
- throw error;
- }
- }
-
- // eslint-disable-next-line no-continue
- if (!response) continue;
+ /* eslint-disable no-await-in-loop */
+ const response = await fetch(url);
// if response code is not between 200-299
if (!response.ok) {
@@ -60,7 +44,7 @@ class PollUntilValid {
return response;
}
- /* eslint-enable */
+ // eslint-disable-next-line no-constant-condition
} while (true);
}
diff --git a/sketch_map_tool/templates/create-results.html b/sketch_map_tool/templates/create-results.html
index ed8a85f3..bf5f07b0 100644
--- a/sketch_map_tool/templates/create-results.html
+++ b/sketch_map_tool/templates/create-results.html
@@ -49,6 +49,7 @@ Map Quality Check Report
Download
PDF
+
Sketch Map Template
Download PDF
+
Geo-referenced markings as GeoTiffs