Skip to content

Commit

Permalink
Added clearer error for invalid argument counts
Browse files Browse the repository at this point in the history
  • Loading branch information
Matt Bell committed Apr 27, 2012
1 parent 6e2d4b0 commit da75f33
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion lib/assembler.js
Expand Up @@ -392,7 +392,8 @@ Assembler.prototype = {
var op = serialized.instructions[this.instruction][0].toUpperCase(), args = serialized.instructions[this.instruction].slice(1);
if( typeof op !== 'undefined') {
if( typeof OPCODES[op] !== 'undefined') {
var error = new Error('Invalid argument count for ' + op);
var error = new Error('Invalid argument count for ' + op + ' (expected '
+ OPCODES[op].args + ', got ' + args.length + ')');

if(OPCODES[op].args === Infinity) {
if(args.length < 1) throw error;
Expand Down
2 changes: 1 addition & 1 deletion package.json
@@ -1,7 +1,7 @@
{
"name": "dcpu16",
"description": "An assembler and a vm for the DCPU-16 CPU from Notch's new game, 0x10c.",
"version": "0.2.18-3",
"version": "0.2.19",
"engines": {
"node": "*"
},
Expand Down

0 comments on commit da75f33

Please sign in to comment.