Uh oh!
There was an error while loading. Please reload this page.
util: update isError with new Error.isError - #57962
Conversation
| @@ -95,7 +95,7 @@ function isError(e) { | |||
| // An error could be an instance of Error while not being a native error | |||
| // or could be from a different realm and not be instance of Error but still | |||
| // be a native error. | |||
| return isNativeError(e) || e instanceof Error; | |||
| return Error.isError ? Error.isError(e) : isNativeError(e) || e instanceof Error; | |||
There was a problem hiding this comment.
Do we need to ensure backward compatibility?
There was a problem hiding this comment.
Error.isError should be the entirety of what isNativeError does, and isNativeError should no longer be needed nor instanceof used.
Wouldn't it make more sense to just remove isError entirely, and use the ErrorIsError primordial directly, and add "don't land" labels on this PR?
There was a problem hiding this comment.
Got it! Do you think it is okay to continue with this PR and issue or would it be better to create a new one?
There was a problem hiding this comment.
seems fine to me to adapt this PR to do that.
There was a problem hiding this comment.
We still want to match errors that are not regular ones. The wild has many examples of these, so we should keep instanceof.
We should deprecate |
LiviaMedeiros
commented
Apr 21, 2025
Just for some clarification: The former is exposed to userspace, and is going to be superseded by The latter is an internal utility that also checks |
ljharb
commented
Apr 21, 2025
If we have any internal errors that are instanceof Error but not proper errors (such that Error.isError returns false on them) then that's something we should fix asap. |
LiviaMedeiros
commented
Apr 21, 2025
I believe |
miguelmarcondesf
commented
Apr 22, 2025
They mentioned in the issue that |
miguelmarcondesf
commented
Apr 22, 2025
It seems to be also used in comparisons |
So given all the context, do you think it would be best to just update the doc to use |
LiviaMedeiros
commented
Apr 22, 2025
We don't need to reference I think the best path forward for this PR is to wait for the V8 update to land on Independently, a doc-only deprecation PR for |
Thanks @LiviaMedeiros for all the clarification! I agree that we should wait for v8 and I'll make the adjustment to all |
Renegade334
commented
May 2, 2025
I'm seeing a >50% performance regression for I don't think that deprecation should really be considered unless this gets addressed upstream.
As a side note, |
ljharb
commented
May 2, 2025
This PR can't land until it's unflagged, regardless. |
Hey, I'm doing some local tests, and indeed, we can't change our |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@## main #57962 +/- ##
==========================================
- Coverage 90.12% 90.06% -0.06%
==========================================
Files 629 629 Lines 186622 186638 +16 Branches 36624 36568 -56 ==========================================
- Hits 168186 168093 -93 - Misses 11217 11349 +132 + Partials 7219 7196 -23
🚀 New features to boost your workflow:
|
miguelmarcondesf
commented
May 8, 2025
Okay, so keeping I'll also open another PR to make the deprecation of |
miguelmarcondesf
commented
May 8, 2025
Hey @Renegade334 sorry but what do you mean by "flagged feature in V8"? |
jasnell
commented
May 12, 2025
The |
Thank you for that explanation! |
geeksilva97
commented
May 12, 2025
We can keep it with a |
This pull request has been marked as stale due to 210 days of inactivity. |
This pull request has been marked as stale due to 90 days of inactivity. |
geeksilva97
commented
Jul 28, 2026
it's been a while 👀 |
Refs 57961
Fixes: #57961
This PR updates the
isErrorfunction inlib/internal/util.jsto use the nativeError.isErrormethod if it is available.