Skip to content

Commit

Permalink
Checks input type string to avoid confusing error (#1254)
Browse files Browse the repository at this point in the history
* Checks input type string to avoid confusing error

* remove quotes
  • Loading branch information
samsonradu authored and frozeman committed Jan 11, 2018
1 parent c0a4f0a commit 5124c0d
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions packages/web3-eth-abi/src/formatters.js
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,10 @@ var formatInputDynamicBytes = function (value) {
* @returns {SolidityParam}
*/
var formatInputString = function (value) {
if(!_.isString(value)) {
throw new Error('Given parameter is not a valid string: ' + value);
}

var result = utils.utf8ToHex(value).replace(/^0x/i,'');
var length = result.length / 2;
var l = Math.floor((result.length + 63) / 64);
Expand Down

0 comments on commit 5124c0d

Please sign in to comment.