Skip to content
This repository has been archived by the owner on Sep 28, 2022. It is now read-only.

Commit

Permalink
clarify error in EthereumTokenService.getToken
Browse files Browse the repository at this point in the history
  • Loading branch information
levity committed Dec 5, 2019
1 parent 143d37c commit e8ae55b
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions packages/dai/src/eth/EthereumTokenService.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import EtherToken from './tokens/EtherToken';
import WethToken from './tokens/WethToken';
import PethToken from './tokens/PethToken';
import ERC20TokenAbi from '../../contracts/abis/ERC20.json';
import assert from 'assert';

export default class EthereumTokenService extends PrivateService {
constructor(name = 'token') {
Expand Down Expand Up @@ -34,9 +35,11 @@ export default class EthereumTokenService extends PrivateService {
// support passing in Currency constructors
if (symbol.symbol) symbol = symbol.symbol;

if (this.getTokens().indexOf(symbol) < 0) {
throw new Error('provided token is not a symbol');
}
assert(symbol, 'Symbol is blank');
assert(
this.getTokens().indexOf(symbol) >= 0,
`Symbol "${symbol}" is not recognized`
);

if (symbol === tokens.ETH) {
return new EtherToken(
Expand Down

0 comments on commit e8ae55b

Please sign in to comment.