Content-Length: 270968 | pFad | http://github.com/angular/angular/pull/62275/commits/6d0d168e44cbd2990cb603bec39645db1bc4df08

E6 fix(core): avoid injecting internal error handler from a destroyed injector by arturovt · Pull Request #62275 · angular/angular · GitHub
Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
fix(core): avoid injecting internal error handler from a destroyed in…
…jector

This commit prevents lazy injection of the internal `ErrorHandler` from a destroyed injector, which would otherwise result in a secondary "destroyed injector" error.

The `handleUncaughtError` function is used in a wrapped event listener that invokes the `ErrorHandler` if the listener throws. A simple case in a micro-frontend application:

```ts
onNavigationToAnotherApp() {
  this.appRef.destroy();
  do_some_stuff_ie_loggin_that_may_throw();
}
```

If the function throws an error, Angular attempts to inject the `ErrorHandler` from a destroyed injector.
  • Loading branch information
arturovt authored and AndrewKushnir committed Aug 27, 2025
commit 6d0d168e44cbd2990cb603bec39645db1bc4df08
7 changes: 6 additions & 1 deletion packages/core/src/render3/instructions/shared.ts
Original file line number Diff line number Diff line change
Expand Up @@ -705,7 +705,12 @@ export function handleUncaughtError(lView: LView, error: any): void {
if (!injector) {
return;
}
const errorHandler = injector.get(INTERNAL_APPLICATION_ERROR_HANDLER, null);
let errorHandler: ((e: any) => void) | null;
try {
errorHandler = injector.get(INTERNAL_APPLICATION_ERROR_HANDLER, null);
} catch {
errorHandler = null;
}
errorHandler?.(error);
}

Expand Down
Loading








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: http://github.com/angular/angular/pull/62275/commits/6d0d168e44cbd2990cb603bec39645db1bc4df08

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy