Skip to content

Commit 03f8c1d

Browse files
committed
Added better errors when calling contracts with incorrect number of arguments.
1 parent 12b68b0 commit 03f8c1d

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

contracts/contract.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,10 @@ function Contract(addressOrName, contractInterface, signerOrProvider) {
7676
throw new Error('unknown transaction override ' + key);
7777
}
7878
}
79+
} else if (params.length > method.inputs.types.length) {
80+
throw new Error('too many parameters');
81+
} else if (params.length < method.inputs.types.length) {
82+
throw new Error('too few parameters');
7983
}
8084

8185
// Check overrides make sense

0 commit comments

Comments
 (0)