Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Drop unnecessary captureStackTrace call #61

Merged
merged 1 commit into from Mar 20, 2022

Conversation

fregante
Copy link
Contributor

@fregante fregante commented Mar 20, 2022

I'm not sure I understand this call. NonError extends Error, which already captures the stack natively:

 node
Welcome to Node.js v16.4.2.
Type ".help" for more information.

> new class NonError extends Error {name='NonError'}
NonError
    at REPL1:1:1
    at Script.runInThisContext (node:vm:129:12)
    at REPLServer.defaultEval (node:repl:522:29)
    at bound (node:domain:416:15)
    at REPLServer.runBound [as eval] (node:domain:427:12)
    at REPLServer.onLine (node:repl:849:10)
    at REPLServer.emit (node:events:406:35)
    at REPLServer.emit (node:domain:470:12)
    at REPLServer.Interface._onLine (node:readline:487:10)
    at REPLServer.Interface._line (node:readline:852:8)

@sindresorhus sindresorhus merged commit 858c046 into sindresorhus:main Mar 20, 2022
@sindresorhus
Copy link
Owner

It used to be required to get a stack trace for error subclasses, but I think JS engines fixed that at some point.

@fregante fregante deleted the patch-1 branch March 20, 2022 16:51
@fregante
Copy link
Contributor Author

Oh I suppose that was the case when Error was not subclassable. I did see some weird stuff to support that.

@sindresorhus
Copy link
Owner

The subclassing syntax worked initially, but it didn't actually properly subclass or something since Error was a built-in.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants