mapbox / mapbox/mapbox-gl-js

Return server response as a text instead of statusText

Open
#10,091 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

feature :green_apple:
Dominant language
TypeScript
Stars
12.4k
Forks
2.4k
PR merge metrics
No merged PRs in 30d

Description

## Motivation
Right now, when a vector tile fails to load, Mapbox is returning an error with the statusText which in most cases is empty.
statusText is ambiguous with http/2

Here is a link to the piece of code I would like to change
https://github.com/mapbox/mapbox-gl-js/blob/94e4714c0ab2896304d72e6322b30fe0bad392a5/src/util/ajax.js#L230
We can change it to
```js
callback(new AJAXError(xhr.responseText || xhr.statusText, xhr.status, requestParameters.url));
```

## Design Alternatives

## Design

### Mock-Up

### Concepts

### Implementation

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in src/util/ajax.js around line 230, the entry point linked in the issue, and inspect how failed vector-tile requests construct AJAXError. Done means the error message uses the server response text when available and retains the status-text fallback.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
networking
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.