[openstreetmap/openstreetmap-website] Check response.ok before parsing JSON in query tool (PR #6724)
Areeb Siddiqui
notifications at github.com
Wed Jan 21 17:01:08 UTC 2026
SykoDaedalus left a comment (openstreetmap/openstreetmap-website#6724)
> I was thinking of something like
>
> ```js
> throw new Error("Response not OK", { cause: {
> status: response.status,
> statusText: response.statusText,
> text: await response.text()
> } });
> ```
>
> and handle that in the `catch` block in the vicinity of this code
>
> https://github.com/openstreetmap/openstreetmap-website/blob/70c2269f5b9c7112998d6443c038591f23763425/app/assets/javascripts/index/query.js#L243
Respone text is something like - `<p><strong style="color:#FF0000">Error</strong>: runtime error: open64: 0 Success /osm3s_osm_base Dispatcher_Client::request_read_and_idx::timeout. The server is probably too busy to handle your request. </p>`
While there is useful information in the response, it's wrapped in HTML and would need parsing to extract. `statusText` already provides a reasonable error message, I feel the added complexity of HTML parsing might not be worth it? However, I can implement it if it can help in debugging the code.
--
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/pull/6724#issuecomment-3779702919
You are receiving this because you are subscribed to this thread.
Message ID: <openstreetmap/openstreetmap-website/pull/6724/c3779702919 at github.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/rails-dev/attachments/20260121/db3b8253/attachment-0001.htm>
More information about the rails-dev
mailing list