jorendorff/js-loaders

Import reject handler never run

guybedford opened this issue · 1 comments

This doesn't seem to be supported for, say, a fetch reject:

  System.import('some/module').then(function(module) {
  }, function(err) {
    // never gets called, even for a fetch error
    console.log(err);
  });

This seems to be because the reject function in AsyncStartLoadPartwayThrough is never called.

This can be fixed by changing step 13 of AsyncStartLoadPartwayThrough from:

  resolve(linkSet.done);

to:

  linkSet.done.then(resolve, reject);

My mistake - promises do resolve correctly in this way.