Skip to content
This repository was archived by the owner on Jul 13, 2020. It is now read-only.

Commit 3201bb4

Browse files
committed
manually merge #404
1 parent ef30253 commit 3201bb4

File tree

5 files changed

+32
-8
lines changed

5 files changed

+32
-8
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,4 @@ bower_components
33
tmp
44
coverage
55
.DS_Store
6+
*.sw?

src/loader.js

Lines changed: 25 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -516,14 +516,35 @@ function logloads(loads) {
516516

517517
// 15.2.5.2.4
518518
function linkSetFailed(linkSet, load, exc) {
519+
function requestsForLoad() {
520+
var reqs = [];
521+
linkSet.loads.forEach(function(aLoad){
522+
aLoad.dependencies.forEach(function(dep){
523+
if (dep.value == load.name) {
524+
reqs.push({as: dep.key, from: aLoad.name});
525+
}
526+
});
527+
});
528+
return reqs;
529+
}
530+
519531
var loader = linkSet.loader;
532+
var requests;
520533

521534
if (load) {
522-
if (load && linkSet.loads[0].name != load.name)
523-
exc = addToError(exc, 'Error loading ' + load.name + ' from ' + linkSet.loads[0].name);
524-
525-
if (load)
535+
if (linkSet.loads[0].name != load.name) {
536+
requests = requestsForLoad();
537+
538+
if (requests[0]) {
539+
var req = requests[0];
540+
exc = addToError(exc, 'Error loading ' + load.name + ' as "' + req.as + '" from ' + req.from);
541+
} else {
542+
exc = addToError(exc, 'Error loading ' + load.name + ' from ' + linkSet.loads[0].name);
543+
}
544+
}
545+
else {
526546
exc = addToError(exc, 'Error loading ' + load.name);
547+
}
527548
}
528549
else {
529550
exc = addToError(exc, 'Error linking ' + linkSet.loads[0].name);

src/system-fetch.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
fulfill(xhr.responseText);
3434
}
3535
function error() {
36-
reject(xhr.statusText + ': ' + url || 'XHR error');
36+
reject(new Error(xhr.statusText + ': ' + url || 'XHR error'));
3737
}
3838

3939
xhr.onreadystatechange = function () {
@@ -68,9 +68,9 @@
6868
else
6969
url = url.substr(7);
7070
return fs.readFile(url, function(err, data) {
71-
if (err)
71+
if (err) {
7272
return reject(err);
73-
else {
73+
} else {
7474
// Strip Byte Order Mark out if it's the leading char
7575
var dataString = data + '';
7676
if (dataString[0] === '\ufeff')
@@ -89,4 +89,4 @@
8989
return new Promise(function(resolve, reject) {
9090
fetchTextFromURL(load.address, resolve, reject);
9191
});
92-
};
92+
};

test/loads/indirect-load.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
import './load-non-existent.js';

test/loads/noent.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export { nothing } from 'nosuchfile.js';

0 commit comments

Comments
 (0)