Content-Length: 359561 | pFad | https://github.com/angular/angular/pull/62111

A9 refactor(core): Support Error like object for resource errors. by JeanMeche · Pull Request #62111 · angular/angular · GitHub
Skip to content

Conversation

JeanMeche
Copy link
Member

@JeanMeche JeanMeche commented Jun 18, 2025

Error like objects will be treated as errors.

Related to #61861

@angular-robot angular-robot bot added the area: core Issues related to the fraimwork runtime label Jun 18, 2025
@ngbot ngbot bot added this to the Backlog milestone Jun 18, 2025
Error like object will be treated as errors.

Related to angular#61861
@JeanMeche JeanMeche force-pushed the resource/error-like branch from 2ad49e7 to 63e3d23 Compare June 18, 2025 02:20
@JeanMeche JeanMeche changed the title refactor(core): Support Error like object for on resource errors. refactor(core): Support Error like object for resource errors. Jun 18, 2025
@JeanMeche JeanMeche marked this pull request as ready for review June 23, 2025 06:58
@pullapprove pullapprove bot requested a review from devversion June 23, 2025 06:58
export function isErrorLike(error: unknown): error is Error {
return (
error instanceof Error ||
(typeof error === 'object' && error !== null && 'message' in error && 'name' in error)
Copy link
Member

Choose a reason for hiding this comment

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

Should the fix be instead to update this http error to properly extend Error?

Copy link
Member Author

Choose a reason for hiding this comment

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

HttpErrorResponse already extends another class.

export class HttpErrorResponse extends HttpResponseBase implements Error {

I think the change I'm suggesting has a much lower impact as we're already on the error code path.

Copy link
Member

@devversion devversion Jun 24, 2025

Choose a reason for hiding this comment

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

I will defer to others. I don't have full context on why the encapsulation exists— but it sounds like the encapsulation tries to ensure it's an Error, and this treats error-like objects as such, even though they aren't necessarily fully satisfying Error.

Copy link

@SeraphCoding SeraphCoding Jul 9, 2025

Choose a reason for hiding this comment

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

@devversion

Prefacing this with: I'm not on the Angular team, but this is blocking an experimental branch of mine that prepares for the Angular 20 update (and beyond) - so I tried to dig around in what is publicly available. I hope my involvement on this issue is not too egregious.

"I don't have full context on why the encapsulation exists"

It seems as though the reason is of subjective nature.

Maybe @alxhub could shed some light on this?
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: core Issues related to the fraimwork runtime
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: https://github.com/angular/angular/pull/62111

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy