mapbox/mapbox-gl-js

Stack not preserved in ajax.js

Open

#11,824 opened on 2022年4月25日

GitHub で見る
 (1 comment) (0 reactions) (0 assignees)JavaScript (10,532 stars) (2,203 forks)batch import
bug :lady_beetle:good first issue

説明

mapbox-gl-js version: 2.3.0, 2.8.1, etc

browser: Chrome etc

Steps to Trigger Behavior

  1. 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));
  2. 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

コントリビューターガイド