Add ZRX_TOKEN_NOT_IN_REGISTRY

This commit is contained in:
Leonid Logvinov
2017-06-02 18:14:51 +02:00
parent 199843718f
commit 16c296be14
2 changed files with 7 additions and 6 deletions

View File

@@ -10,11 +10,12 @@ function strEnum(values: string[]): {[key: string]: string} {
} }
export const ZeroExError = strEnum([ export const ZeroExError = strEnum([
'CONTRACT_DOES_NOT_EXIST', 'CONTRACT_DOES_NOT_EXIST',
'UNHANDLED_ERROR', 'UNHANDLED_ERROR',
'USER_HAS_NO_ASSOCIATED_ADDRESSES', 'USER_HAS_NO_ASSOCIATED_ADDRESSES',
'INVALID_SIGNATURE', 'INVALID_SIGNATURE',
'CONTRACT_NOT_DEPLOYED_ON_NETWORK', 'CONTRACT_NOT_DEPLOYED_ON_NETWORK',
'ZRX_NOT_IN_TOKEN_REGISTRY',
]); ]);
export type ZeroExError = keyof typeof ZeroExError; export type ZeroExError = keyof typeof ZeroExError;

View File

@@ -11,7 +11,7 @@ export class TokenUtils {
public getProtocolTokenOrThrow(): Token { public getProtocolTokenOrThrow(): Token {
const zrxToken = _.find(this.tokens, {symbol: PROTOCOL_TOKEN_SYMBOL}); const zrxToken = _.find(this.tokens, {symbol: PROTOCOL_TOKEN_SYMBOL});
if (_.isUndefined(zrxToken)) { if (_.isUndefined(zrxToken)) {
throw new Error(ZeroExError.CONTRACT_NOT_DEPLOYED_ON_NETWORK); throw new Error(ZeroExError.ZRX_NOT_IN_TOKEN_REGISTRY);
} }
return zrxToken; return zrxToken;
} }