-
Notifications
You must be signed in to change notification settings - Fork 27.1k
Closed
Labels
P3An issue that is relevant to core functions, but does not impede progress. Important, but not urgentAn issue that is relevant to core functions, but does not impede progress. Important, but not urgentarea: coreIssues related to the framework runtimeIssues related to the framework runtimecore: bootstrapfreq2: mediumstate: has PRtype: bug/fix
Milestone
Description
I'm submitting a...
[ ] Regression (a behavior that used to work and stopped working in a new release)
[x] Bug report
[ ] Feature request
[ ] Documentation issue or request
[ ] Support request => Please do not submit support request here, instead see https://github.com/angular/angular/blob/master/CONTRIBUTING.md#question
Current behavior
The following provider will cause Angular to throw an error.
const INIT_PROVIDER = {
provide: APP_INITIALIZER,
useFactory: initFactory,
multi: true
};
function initFactory() {
return () => init();
}
function init() {
return new Promise((resolve, reject) => {
reject();
});
}The error occurs here:
angular/packages/core/src/errors.ts
Lines 25 to 27 in 0cc77b4
| export function getOriginalError(error: Error): Error { | |
| return (error as any)[ERROR_ORIGINAL_ERROR]; | |
| } |
ERROR_ORIGINAL_ERROR ('ngOriginalError') doesn't exist on error at this point.
Related: #18523
Expected behavior
The error should not occur. Unsure on what should happen in case the Promise is rejected but logging an error and continue operating seems like a good solution.
Minimal reproduction of the problem with instructions
https://stackblitz.com/edit/angular-gitter-p6cngp
Open up the console and following error will appear:
Unhandled Promise rejection: Cannot read property 'ngOriginalError' of undefined
Environment
Angular version: 5.1.2
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
P3An issue that is relevant to core functions, but does not impede progress. Important, but not urgentAn issue that is relevant to core functions, but does not impede progress. Important, but not urgentarea: coreIssues related to the framework runtimeIssues related to the framework runtimecore: bootstrapfreq2: mediumstate: has PRtype: bug/fix