throw error if there is no string representation
This commit is contained in:
parent
3b2b725070
commit
eaaf8aade3
|
@ -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 = {
|
||||
|
|
Loading…
Reference in New Issue