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

Skip to content

Conversation

TheYoungBeast
Copy link

PR Checklist

Please check if your PR fulfills the following requirements:

PR Type

What kind of change does this PR introduce?

  • Bugfix
  • Feature
  • Code style update (formatting, local variables)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • CI related changes
  • Documentation content changes
  • angular.dev application / infrastructure changes
  • Other... Please describe:

What is the current behavior?

RxResource signals were intended to work with the RxJs Observables.
Those are often encapsulated inside the service layer or produced as a by-product by the HttpClient.
Currently, rxResource throws an Error described in the issues below, even though HttpErrorResponse implements the Error interface.
This PR addresses the issue for the rxResource signals.

Issue Number: #62099, #61861

What is the new behavior?

No longer throws an error "Resource returned an error that's not an Error instance".
Successfully returns the intended value by error() signal.

Does this PR introduce a breaking change?

  • Yes
  • No

Other information

…ce" for observables that produce HttpErrorResponse inside the rxResource signal (angular#62099) (related to angular#61861)
@angular-robot angular-robot bot added the area: core Issues related to the framework runtime label Jun 18, 2025
@ngbot ngbot bot added this to the Backlog milestone Jun 18, 2025
@@ -15,6 +15,7 @@ ng_project(
),
interop_deps = [
"//packages/core",
"//packages/common/http",
Copy link
Member

Choose a reason for hiding this comment

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

Dependency wise, the rxjs-interop should not depend on common/http.

Comment on lines +30 to +32
if (error instanceof HttpErrorResponse) {
return error;
}
Copy link
Member

Choose a reason for hiding this comment

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

This won't fix any other observable that throw an instance that isn't an error.

Copy link
Author

Choose a reason for hiding this comment

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

@JeanMeche I'm aware of that, and I believe that's the point. error() signal returns value of type Error. Consider HttpErrorResponse to be a "built-in" type and should be fully supported, especially given that it implements the Error interface.
My PR addresses the issue for the observables produced by HttpClient, which, in my opinion, is a good step in improving the API.
To support all types of Errors, I believe the API should be rethought and might be addressed in further PRs upon agreeing on the details.

Copy link
Member

Choose a reason for hiding this comment

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

I'll run some tests with #62111

@thePunderWoman thePunderWoman added the action: cleanup The PR is in need of cleanup, either due to needing a rebase or in response to comments from reviews label Jun 24, 2025
@JeanMeche
Copy link
Member

Thanks for you're contribution, but we won't go with this change.

@JeanMeche JeanMeche closed this Jun 27, 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 Jul 28, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
action: cleanup The PR is in need of cleanup, either due to needing a rebase or in response to comments from reviews area: core Issues related to the framework runtime
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants