jorendorff / js-loaders

Pseudoimplementation of the proposed ES6 module loaders.
54 stars 7 forks source link

Normalize errors not being rejected through LoadFailed #93

Closed guybedford closed 10 years ago

guybedford commented 10 years ago

In 1.1.1.15 ProcessLoadDependencies, it creates a promiseAll for the load records of the dependencies, then adds LoadSucceeded as the next step after this.

If there is a normalize error / rejection in any of the dependency load records, then this doesn't result in LoadFailed being called.

The fix is to remove steps 6, 7 and 8 from 1.1.1.15 ProcessLoadDependencies, and instead move them to after step 12 of 1.1.1.8 ProceedToTranslate.

This way, InstantiateSucceeded returns a promise for the load dependencies, and on failure will call LoadFailed.

For the relevant change in ES6 Module Loader along with tests, see https://github.com/ModuleLoader/es6-module-loader/commit/309d690e4eafe9d8ec534cf7a854a7d5b1c32d55

guybedford commented 10 years ago

This was my misinterpretation of the catch call on the load promises. LoadFailed does catch everything here fine.