Reject on font loading error
This commit is contained in:
@@ -122,12 +122,18 @@ module.exports = function(options, repo, params, id, dataResolver) {
|
|||||||
var existingFonts = {};
|
var existingFonts = {};
|
||||||
var fontListingPromise = new Promise(function(resolve, reject) {
|
var fontListingPromise = new Promise(function(resolve, reject) {
|
||||||
fs.readdir(options.paths.fonts, function(err, files) {
|
fs.readdir(options.paths.fonts, function(err, files) {
|
||||||
|
if (err) {
|
||||||
|
reject(err);
|
||||||
|
return;
|
||||||
|
}
|
||||||
files.forEach(function(file) {
|
files.forEach(function(file) {
|
||||||
fs.stat(path.join(options.paths.fonts, file), function(err, stats) {
|
fs.stat(path.join(options.paths.fonts, file), function(err, stats) {
|
||||||
if (!err) {
|
if (err) {
|
||||||
if (stats.isDirectory()) {
|
reject(err);
|
||||||
existingFonts[path.basename(file)] = true;
|
return;
|
||||||
}
|
}
|
||||||
|
if (stats.isDirectory()) {
|
||||||
|
existingFonts[path.basename(file)] = true;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user