bublejs / bublejs/buble

Extending Error is flaky because `Error.call` returns a new object

Open
#40 5 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
JavaScript
Stars
874
Forks
62
PR merge metrics
No merged PRs in 30d

Description

I.e. `let x = {}; Error.call(x) == x` produces false, at least on Firefox and Chrome. This is preventing Error subclasses compiled with Bublé from getting `stack` and `message` properties, making them rather useless.

Babel works around this by creating a new binding to replace `this` inside the constructor, storing the result of the super constructor call in that, and returning it at the end. Would that be something that Bublé would be interested in adding? I might be able to create a PR.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.