@tomhughes commented on this pull request.


> +      try {
+        detailMessage = event?.detail?.error?.message;
+        if (!detailMessage) {
+          const responseText = await event.detail.fetchResponse.responseText;
+          const parser = new DOMParser();
+          const doc = parser.parseFromString(responseText, "text/html");
+          detailMessage = doc.body ? doc.body.textContent.trim() : "(unknown)";
+        }
+      } catch (err) {
+        detailMessage = "(unknown)";
+      }
+      // eslint-disable-next-line no-alert
+      alert(OSM.i18n.t("javascripts.share.export_failed", { reason: 
detailMessage }));
+    }
+
+    static getTurboBlobHandler(downloadCallback) {

This is setup to return a function that captures the callback but in fact both 
users are using very similar callbacks - in particular they are both just 
forwarding to `OSM.downloadBlob`.

So wouldn't make more sense for this just to take the filename (which is the 
only thing that changes and needs to be captured) and put the `downloadBlob` 
call in here?

-- 
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/pull/6255#pullrequestreview-3059419928
You are receiving this because you are subscribed to this thread.

Message ID: 
<openstreetmap/openstreetmap-website/pull/6255/review/3059419...@github.com>
_______________________________________________
rails-dev mailing list
rails-dev@openstreetmap.org
https://lists.openstreetmap.org/listinfo/rails-dev

Reply via email to