Skip to content

Commit

Permalink
Throw error when a name table entry is not existing + Improve throw e…
Browse files Browse the repository at this point in the history
…rror message of Font.download()
  • Loading branch information
Jolg42 committed Jun 23, 2016
1 parent 5bd2de0 commit 00a408d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/font.js
Original file line number Diff line number Diff line change
Expand Up @@ -320,7 +320,7 @@ Font.prototype.download = function() {
});
},
function(err) {
throw err;
throw new Error(err.name + ': ' + err.message);
});
} else {
var fs = require('fs');
Expand Down
5 changes: 5 additions & 0 deletions src/tables/name.js
Original file line number Diff line number Diff line change
Expand Up @@ -744,6 +744,11 @@ function makeNameTable(names, ltag) {
}

nameID = parseInt(id);

if (isNaN(nameID)) {
throw new Error('Name table entry "' + key + '" does not exist, see nameTableNames for complete list.');
}

namesWithNumericKeys[nameID] = names[key];
nameIDs.push(nameID);
}
Expand Down

0 comments on commit 00a408d

Please sign in to comment.