mapbox/mapbox-gl-js

Stack not preserved in ajax.js

Open

#11,824 创建于 2022年4月25日

在 GitHub 查看
 (1 评论) (0 反应) (0 负责人)JavaScript (10,532 star) (2,203 fork)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

贡献者指南