mapbox/mapbox-gl-js

Stack not preserved in ajax.js

开放

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

 (1 条评论) (0 个反应) (0 位负责人)JavaScript (2,203 个派生)batch import
bug :lady_beetle:good first issue

仓库指标

星标
 (10,532 个星标)
PR 合并指标
 (PR 指标待抓取)

描述

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

贡献者指南