Fix collection failure if entry fails. (#1093)

This commit is contained in:
Caleb 2018-03-05 16:31:05 -07:00 committed by GitHub
parent 1647d0b8e5
commit 95b6d8a884
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -72,13 +72,15 @@ export default class GitHub {
sem.take(() => this.api.readFile(file.path, file.sha).then((data) => {
resolve({ file, data });
sem.leave();
}).catch((err) => {
}).catch((err = true) => {
sem.leave();
reject(err);
console.error(`failed to load file from GitHub: ${file.path}`);
resolve({ error: err });
}))
)));
});
return Promise.all(promises);
return Promise.all(promises)
.then(loadedEntries => loadedEntries.filter(loadedEntry => !loadedEntry.error));
};
// Fetches a single entry.