From eaaf8aade343ff321ba382a315b41bf1cf3a54d7 Mon Sep 17 00:00:00 2001 From: "Ryan X. Charles" Date: Mon, 1 Sep 2014 20:00:54 -0700 Subject: [PATCH] throw error if there is no string representation --- lib/opcode.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/opcode.js b/lib/opcode.js index 417213d82..04c3ccfef 100644 --- a/lib/opcode.js +++ b/lib/opcode.js @@ -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 = {