throw error if there is no string representation

This commit is contained in:
Ryan X. Charles 2014-09-01 20:00:54 -07:00
parent 3b2b725070
commit eaaf8aade3
1 changed files with 4 additions and 1 deletions

View File

@ -33,7 +33,10 @@ Opcode.prototype.fromString = function(str) {
};
Opcode.prototype.toString = function() {
return Opcode.reverseMap[this.num];
var str = Opcode.reverseMap[this.num];
if (typeof str === 'undefined')
throw new Error('Opcode does not have a string representation');
return str;
};
Opcode.map = {