Skip to content

Handle OSM API connection timeouts and network errors#1778

Draft
Copilot wants to merge 2 commits intomainfrom
copilot/handle-osm-api-timeouts
Draft

Handle OSM API connection timeouts and network errors#1778
Copilot wants to merge 2 commits intomainfrom
copilot/handle-osm-api-timeouts

Conversation

Copy link

Copilot AI commented Mar 2, 2026

Network-level errors (ERR_CONNECTION_CLOSED, ERR_TIMED_OUT) thrown by fetch as TypeError were silently swallowed in OsmService.js catch blocks, which only handled AbortError and FetchError. This meant the app got no feedback and no apistatuschange event when the OSM API was completely unreachable.

Changes

  • All fetch catch blocks (loadFromAPI, openChangeset, uploadChangeset, closeChangeset, postNote, postNoteUpdate): removed the FetchError-specific guard so all non-abort errors are forwarded to the error callback:

    // Before — TypeError falls through silently
    .catch(err => {
      if (err.name === 'AbortError') return;
      if (err.name === 'FetchError') { errback(err); return; }
    });
    
    // After
    .catch(err => {
      if (err.name === 'AbortError') return;
      errback(err);  // FetchError or network error (e.g. TypeError from connection timeout)
    });
  • status(): added AbortSignal.timeout(10000) to the capabilities fetch so a hanging connection fails fast instead of waiting for the OS TCP timeout (2+ min).

    fetch(url, { signal: AbortSignal.timeout(10000) })
Original prompt

This section details on the original issue you should resolve

<issue_title>Handle OSM API Timeouts</issue_title>
<issue_description>Followup on #1304
We already handle a bunch of different error conditions with the OSM API.
But when things get really bad, we don't even get a response from the capabilities or any of the other calls, just a connection timeout:

Screenshot 2024-07-11 at 9 41 22 AM

We should handle this situation too.</issue_description>

Comments on the Issue (you are @copilot in this section)


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Co-authored-by: jenningsanderson <1637425+jenningsanderson@users.noreply.github.com>
Copilot AI changed the title [WIP] Handle OSM API timeouts in error conditions Handle OSM API connection timeouts and network errors Mar 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Handle OSM API Timeouts

2 participants