bug :lady_beetle:good first issue
Description
mapbox-gl-js version: 2.3.0, 2.8.1, etc
browser: Chrome etc
Steps to Trigger Behavior
- Somehow get an error with a puzzling message which hits https://github.com/mapbox/mapbox-gl-js/blob/main/src/util/ajax.js#L182
if (!aborted) callback(new Error(err.message)); - Notice that the new error discards the stack which makes figuring out the error difficult
Link to Demonstration
In my case the error showed up in tracking, and the repro steps are unclear. Hence, a stack trace would really help. The error message itself is Error: Cannot read properties of undefined (reading 'send') which is hard to debug, and it could be our bug, a mapbox bug, or anything else. So preserving the stack trace somehow or other would be useful to debug what is happening.
Obviously, stack preservation anywhere else errors are wrapped like this would be useful.
Expected Behavior
The error has a convenient stack trace from the original error
Actual Behavior
It does not