Thanks to visit codestin.com
Credit goes to github.com

Skip to content

fix(common): Handle errors in async pipe subscriptions #60057

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

Closed
wants to merge 1 commit into from

Conversation

atscott
Copy link
Contributor

@atscott atscott commented Feb 21, 2025

AsyncPipe would previously promise rejections unhandled and subscription errors uncaught. This is more or less fine in a Zone-based application because errors inside the Angular Zone are caught be the Zone's error trap and reported to ErrorHandler. However, in zoneless applications, these errors are never caught or reported by the FW and can reach the node process in SSR and cause it to shut down.

BREAKING CHANGE: AsyncPipe now directly catches unhandled errors in subscriptions and promises and reports them to the application's ErrorHandler. For Zone-based applications, these errors would have been caught by ZoneJS and reported to ErrorHandler so the result is generally the same. The change to the exact mechanism for reporting can result in differences in test environments that will require test updates.

`AsyncPipe` would previously promise rejections unhandled and
subscription errors uncaught. This is more or less fine in a Zone-based
application because errors inside the Angular Zone are caught be the
Zone's error trap and reported to `ErrorHandler`. However, in zoneless
applications, these errors are never caught or reported by the FW and
can reach the node process in SSR and cause it to shut down.

BREAKING CHANGE: `AsyncPipe` now directly catches unhandled errors in
subscriptions and promises and reports them to the application's
`ErrorHandler`. For Zone-based applications, these errors would have
been caught by ZoneJS and reported to `ErrorHandler` so the result is
generally the same. The change to the exact mechanism for reporting can
result in differences in test environments that will require test
updates.
@atscott atscott added area: common Issues related to APIs in the @angular/common package target: major This PR is targeted for the next major release requires: TGP This PR requires a passing TGP before merging is allowed labels Feb 21, 2025
@ngbot ngbot bot added this to the Backlog milestone Feb 21, 2025
@pullapprove pullapprove bot removed the requires: TGP This PR requires a passing TGP before merging is allowed label Feb 21, 2025
@angular-robot angular-robot bot added the detected: breaking change PR contains a commit with a breaking change label Feb 21, 2025
@AndrewKushnir AndrewKushnir requested a review from alxhub February 25, 2025 01:15
Copy link
Contributor

@AndrewKushnir AndrewKushnir left a comment

Choose a reason for hiding this comment

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

The change looks good (I've looked at it earlier as well) 👍

It'd be helpful if @alxhub takes a look as well when he has a chance.

@atscott
Copy link
Contributor Author

atscott commented Mar 3, 2025

@atscott atscott added the action: merge The PR is ready for merge by the caretaker label Mar 3, 2025
@ngbot
Copy link

ngbot bot commented Mar 3, 2025

I see that you just added the action: merge label, but the following checks are still failing:
    failure status "google-internal-tests" is failing
    pending status "mergeability" is pending

If you want your PR to be merged, it has to pass all the CI checks.

If you can't get the PR to a green state due to flakes or broken main, please try rebasing to main and/or restarting the CI job. If that fails and you believe that the issue is not due to your change, please contact the caretaker and ask for help.

@mmalerba mmalerba removed the action: merge The PR is ready for merge by the caretaker label Mar 4, 2025
@mmalerba
Copy link
Contributor

mmalerba commented Mar 4, 2025

removing the action: merge label since there are presubmit failures

@mmalerba
Copy link
Contributor

mmalerba commented Mar 4, 2025

actually I see TGP passed for the same snapshot, I think this just got caught up in yesterday's TAP breakage. Adding back the label, I believe this is safe to merge

@mmalerba mmalerba added the action: merge The PR is ready for merge by the caretaker label Mar 4, 2025
@ngbot
Copy link

ngbot bot commented Mar 4, 2025

I see that you just added the action: merge label, but the following checks are still failing:
    failure status "google-internal-tests" is failing

If you want your PR to be merged, it has to pass all the CI checks.

If you can't get the PR to a green state due to flakes or broken main, please try rebasing to main and/or restarting the CI job. If that fails and you believe that the issue is not due to your change, please contact the caretaker and ask for help.

@mmalerba
Copy link
Contributor

mmalerba commented Mar 4, 2025

This PR was merged into the repository by commit 739cada.

The changes were merged into the following branches: main

@mmalerba mmalerba closed this in 739cada Mar 4, 2025
@angular-automatic-lock-bot
Copy link

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 Apr 4, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
action: merge The PR is ready for merge by the caretaker area: common Issues related to APIs in the @angular/common package detected: breaking change PR contains a commit with a breaking change target: major This PR is targeted for the next major release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants