Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error strings in utils module updated #2705

Merged
merged 3 commits into from
Apr 17, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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