-
Notifications
You must be signed in to change notification settings - Fork 26.4k
Closed
Description
Which @angular/* package(s) are the source of the bug?
compiler, core
Is this a regression?
Yes
Description
This code:
import {
EnvironmentInjector,
inject,
Component,
runInInjectionContext,
} from '@angular/core';
@Component({
selector: 'app-root',
template: `
Welcome to Angular!
`,
})
export class App {
private readonly _injector: EnvironmentInjector = inject(EnvironmentInjector);
constructor() {
console.log('app start');
setTimeout(async () => {
try {
return runInInjectionContext(this._injector, async () => {
throw new Error('error');
});
} catch (e) {
console.log('in Catch');
}
}, 200);
}
}
in angular 20 this will trigger the angular error handler. In previous versions this did not happen.
The consequence of this is that you cannot choose to handle errors anymore that happen inside of the runInInjectionContext without that it triggers the error handler.
without
Please provide a link to a minimal reproduction of the bug
No response
Please provide the exception or error you saw
Please provide the environment you discovered this bug in (run ng version
)
Anything else?
No response
CataMS
Metadata
Metadata
Assignees
Labels
No labels