Skip to content

fix(zone.js): fix several behavior diffs when Promise reject unhandled - #49589

Closed
JiaLiPassion wants to merge 1 commit into
angular:mainfrom
JiaLiPassion:promise-reject
Closed

JiaLiPassion wants to merge 1 commit into
angular:mainfrom
JiaLiPassion:promise-reject

Conversation

@JiaLiPassion

Copy link
Copy Markdown
Contributor

Close #47562

There are several behavior differences between ZoneAwarePromise and Native Promise.

Such as.

Promise.reject(new Error("test error")).finally(() => console.log("finally"));
  1. Native Promise, will console log finally and throw a Promise unhandled error also process exit with code 1.
  2. ZoneAwarePromise, will console log finally but will not output any uncaught error also process exit with code 0.

This PR fix the issue and make Promise rejection behave the same with the native one.

@JiaLiPassion
JiaLiPassion force-pushed the promise-reject branch 2 times, most recently from f62f354 to 25f764e Compare March 25, 2023 04:50
@dylhunn dylhunn added the area: zones Issues related to zone.js label Apr 4, 2023
@ngbot ngbot Bot added this to the Backlog milestone Apr 4, 2023
@JiaLiPassion
JiaLiPassion requested review from alan-agius4 and removed request for AndrewKushnir December 13, 2023 22:39
@alan-agius4 alan-agius4 added action: review The PR is still awaiting reviews from at least one requested reviewer target: patch This PR is targeted for the next patch release labels Dec 14, 2023

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you explain why these tests have been added but disabled?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I refactored the test cases, now it can work in both nodejs and browser.

@alan-agius4

Copy link
Copy Markdown
Contributor

@alan-agius4 alan-agius4 added action: cleanup The PR is in need of cleanup, either due to needing a rebase or in response to comments from reviews and removed action: review The PR is still awaiting reviews from at least one requested reviewer labels Dec 14, 2023
There are several behavior differences between ZoneAwarePromise and
Native Promise.

Such as.

```
Promise.reject(new Error("test error")).finally(() => console.log("finally"));
```

1. Native Promise, will console log `finally` and throw a Promise
   unhandled error also process exit with code 1.
2. ZoneAwarePromise, will console log `finally` but will not output any
   uncaught error also process exit with code 0.

This PR fix the issue and make Promise rejection behave the same with
the native one.

PR Close angular#47562
@JiaLiPassion

Copy link
Copy Markdown
Contributor Author

@alan-agius4 , I updated the PR, now CI is green.

@alan-agius4 alan-agius4 added action: global presubmit The PR is in need of a google3 global presubmit and removed action: cleanup The PR is in need of cleanup, either due to needing a rebase or in response to comments from reviews labels Dec 14, 2023
@alan-agius4 alan-agius4 self-assigned this Dec 14, 2023
@alan-agius4

Copy link
Copy Markdown
Contributor

TGP

@alan-agius4 alan-agius4 removed their assignment Dec 14, 2023
@alan-agius4 alan-agius4 removed the action: global presubmit The PR is in need of a google3 global presubmit label Dec 14, 2023
@angular-automatic-lock-bot

Copy link
Copy Markdown

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot Bot locked and limited conversation to collaborators Jul 7, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

area: zones Issues related to zone.js state: blocked target: patch This PR is targeted for the next patch release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Promise rejection with finally, does not throw unhandled rejection

4 participants