Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

Causes observable changes with prepareStackTrace

Đang mở
#8 9 bình luận 0 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Đánh giá

Độ khó
5/5
Thời gian dự kiến
Hơn một tuần
Mức phù hợp với người mới
25/100
Loại issue
Tính năng
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Đình trệ
Công nghệ
javascript
Lĩnh vực
tooling

Hướng nghiên cứu

Start with the issue's Error.captureStackTrace and Error.prepareStackTrace example, then inspect the linked source-map-support implementation at source-map-support.js around line 397. Compare the observable ordering and evaluation-cost concerns described here; the work is complete when the proposal has a decided behavior and its compatibility implications are documented.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

When requiring the stack properties value to be eagerly evaluated in captureStackTrace there is a problematic interaction with the existing accompanying prepareStackTrace. That one allows arbitrarily formatting of the stack trace attached to the error object. This makes it observable when the string content of the stack property is computed.

The proposal here would require eager evaluation of the stack formatting code at captureStackTrace time. Whereas the current implementation does it lazily.

Error.prepareStackTrace = (error, stack) => {console.log("2. prepare")};
let err = {}; 
Error.captureStackTrace(err);
console.log("1. capture");
err.stack;

Here we would essentially have to swap the order of effect 1 and 2.

I think this is not just a theoretical issue. Next to an observable change in behavior it would also make the prepareStackTrace API prohibitively expensive to use.

There is evidence of effectfull and expensive prepareStackTrace handlers, see e.g., source-map-support for node.

Ngôn ngữ chính
Không có dữ liệu ngôn ngữ
Star
15
Fork
5
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của tc39/proposal-error-capturestacktrace

Tất cả issue của tc39/proposal-error-capturestacktrace

Issue tương tự

Thêm issue về DevTools

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.