Missing Mapbox access token for a Mapbox source does not trigger the map.on('error') event
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 12.4k
- Forks
- 2.4k
- PR merge metrics
- No merged PRs in 30d
Description
mapbox-gl@0.44.2:
### Steps to Trigger Behavior
1. Instantiate a map
2. Bind to the mapbox-gl on error event
3. Do not specify a Mapbox access token
4. Load a style JSON with a source pointed at a mapbox:// endpoint
5. Thrown error caught by console but does not trigger error event
### Expected Behavior
Mapbox auth errors should trigger the [map.on('error')](https://www.mapbox.com/mapbox-gl-js/api/#map.event:error) event similar to all other Mapbox errors.
### Actual Behavior
Error event not triggered - caught instead by console.
### Additional Notes
According to the [error event documentation](https://www.mapbox.com/mapbox-gl-js/api/#map.event:error), mapbox-gl should use the error event instead of throwing an error. A link to where the error is thrown in the code [src/util/mapbox.js](https://github.com/mapbox/mapbox-gl-js/blob/03680eb57489cf442f8c538141ea27c73d98d532/src/util/mapbox.js#L29).
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with src/util/mapbox.js at the linked error location and reproduce the documented steps using a mapbox:// source without an access token. Trace how the authentication error is handled relative to map.on('error'). Done means the missing-token error triggers the map error event instead of only being caught by the console.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- frontend, web-dev
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 45/100