Skip to content

Commit

Permalink
Merge pull request #2705 from ethereum/issue/2468
Browse files Browse the repository at this point in the history
Error strings in utils module updated
  • Loading branch information
nivida authored Apr 17, 2019
2 parents 6fb8c14 + 7499a1e commit 42f9126
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions packages/web3-utils/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ export const fromWei = (number, unit) => {
unit = getUnitValue(unit);

if (!utils.isBN(number) && !isString(number)) {
throw new Error('Please pass numbers as strings or BigNumber objects to avoid precision errors.');
throw new Error('Please pass numbers as strings or BN objects to avoid precision errors.');
}

return utils.isBN(number) ? ethjsUnit.fromWei(number, unit) : ethjsUnit.fromWei(number, unit).toString(10);
Expand Down Expand Up @@ -229,7 +229,7 @@ export const toWei = (number, unit) => {
unit = getUnitValue(unit);

if (!utils.isBN(number) && !isString(number)) {
throw new Error('Please pass numbers as strings or BigNumber objects to avoid precision errors.');
throw new Error('Please pass numbers as strings or BN objects to avoid precision errors.');
}

return utils.isBN(number) ? ethjsUnit.toWei(number, unit) : ethjsUnit.toWei(number, unit).toString(10);
Expand Down
2 changes: 1 addition & 1 deletion packages/web3-utils/tests/src/UtilsTest.js
Original file line number Diff line number Diff line change
Expand Up @@ -461,7 +461,7 @@ describe('UtilsTest', () => {

expect(() => {
toWei(1, 'wei');
}).toThrow('Please pass numbers as strings or BigNumber objects to avoid precision errors.');
}).toThrow('Please pass numbers as strings or BN objects to avoid precision errors.');
});

it('calls utf8ToHex and returns the expected results', () => {
Expand Down

0 comments on commit 42f9126

Please sign in to comment.