Skip to content

Commit

Permalink
generalized ArgumentError message
Browse files Browse the repository at this point in the history
  • Loading branch information
ArturLevchuk committed Sep 18, 2024
1 parent 2c7d87f commit 50285cc
Show file tree
Hide file tree
Showing 8 changed files with 19 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ class AuroraBlockChainService implements BlockChainService {
Future<String> getWalletBalance(AccountInfoRequest accountInfoRequest) {
if (accountInfoRequest is! EvmAccountInfoRequest) {
throw ArgumentError(
"Invalid accountInfoRequest. It must be of type `EvmAccountInfoRequest`");
"Invalid accountInfoRequest type. Expected: `EvmAccountInfoRequest`");
}
return auroraRpcClient.getAccountBalance(accountInfoRequest.accountId);
}
Expand All @@ -99,7 +99,7 @@ class AuroraBlockChainService implements BlockChainService {
if (blockChainNetworkEnvironmentSettings
is! EvmNetworkEnvironmentSettings) {
throw ArgumentError(
"Invalid blockChainNetworkEnvironmentSettings. It must be of type `EvmNetworkEnvironmentSettings`");
"Invalid blockChainNetworkEnvironmentSettings type. Expected: `EvmNetworkEnvironmentSettings`");
}
auroraRpcClient.networkClient
.setUrl(blockChainNetworkEnvironmentSettings.chainUrl);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ class AvalancheBlockChainService implements BlockChainService {
Future<String> getWalletBalance(AccountInfoRequest accountInfoRequest) {
if (accountInfoRequest is! EvmAccountInfoRequest) {
throw ArgumentError(
"Invalid accountInfoRequest. It must be of type `EvmAccountInfoRequest`");
"Invalid accountInfoRequest type. Expected: `EvmAccountInfoRequest`");
}
return avalancheRpcClient.getAccountBalance(accountInfoRequest.accountId);
}
Expand All @@ -100,7 +100,7 @@ class AvalancheBlockChainService implements BlockChainService {
if (blockChainNetworkEnvironmentSettings
is! EvmNetworkEnvironmentSettings) {
throw ArgumentError(
"Invalid blockChainNetworkEnvironmentSettings. It must be of type `EvmNetworkEnvironmentSettings`");
"Invalid blockChainNetworkEnvironmentSettings type. Expected: `EvmNetworkEnvironmentSettings`");
}
avalancheRpcClient.networkClient
.setUrl(blockChainNetworkEnvironmentSettings.chainUrl);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ class BitcoinBlockChainService implements BlockChainService {
TransferRequest transferRequest) async {
if (transferRequest is! BitcoinTransferRequest) {
throw ArgumentError(
'Incorrect TransferRequest type. Must be `BitcoinTransferRequest`');
'Invalid transferRequest type. Expected: `BitcoinTransferRequest`');
}

final format = 'SEGWIT';
Expand Down Expand Up @@ -78,7 +78,7 @@ class BitcoinBlockChainService implements BlockChainService {
) async {
if (accountInfoRequest is! BitcoinAccountInfoRequest) {
throw ArgumentError(
'Invalid accountInfoRequest. It must be of type `BitcoinAccountInfoRequest`');
'Invalid accountInfoRequest type. Expected: `BitcoinAccountInfoRequest`');
}
final addressId =
await getAdressBTCSegWitFomat(accountInfoRequest.accountId);
Expand All @@ -94,7 +94,7 @@ class BitcoinBlockChainService implements BlockChainService {
if (blockChainNetworkEnvironmentSettings
is! BitcoinNetworkEnvironmentSettings) {
throw ArgumentError(
'Invalid blockChainNetworkEnvironmentSettings. It must be of type `BitcoinNetworkEnvironmentSettings`');
'Invalid blockChainNetworkEnvironmentSettings type. Expected: `BitcoinNetworkEnvironmentSettings`');
}
bitcoinRpcClient.networkClient
.setUrl(blockChainNetworkEnvironmentSettings.chainUrl);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ class BNBBlockChainService implements BlockChainService {
Future<String> getWalletBalance(AccountInfoRequest accountInfoRequest) {
if (accountInfoRequest is! EvmAccountInfoRequest) {
throw ArgumentError(
"Invalid accountInfoRequest. It must be of type `EvmAccountInfoRequest`");
"Invalid accountInfoRequest type. Expected: `EvmAccountInfoRequest`");
}
return bnbRpcClient.getAccountBalance(accountInfoRequest.accountId);
}
Expand All @@ -99,7 +99,7 @@ class BNBBlockChainService implements BlockChainService {
if (blockChainNetworkEnvironmentSettings
is! EvmNetworkEnvironmentSettings) {
throw ArgumentError(
"Invalid blockChainNetworkEnvironmentSettings. It must be of type `EvmNetworkEnvironmentSettings`");
"Invalid blockChainNetworkEnvironmentSettings type. Expected: `EvmNetworkEnvironmentSettings`");
}
bnbRpcClient.networkClient
.setUrl(blockChainNetworkEnvironmentSettings.chainUrl);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ class EthereumBlockChainService implements BlockChainService {
Future<String> getWalletBalance(AccountInfoRequest accountInfoRequest) {
if (accountInfoRequest is! EvmAccountInfoRequest) {
throw ArgumentError(
"Invalid accountInfoRequest. It must be of type `EvmAccountInfoRequest`");
"Invalid accountInfoRequest type. Expected: `EvmAccountInfoRequest`");
}
return ethereumRpcClient.getAccountBalance(accountInfoRequest.accountId);
}
Expand All @@ -93,7 +93,7 @@ class EthereumBlockChainService implements BlockChainService {
if (blockChainNetworkEnvironmentSettings
is! EvmNetworkEnvironmentSettings) {
throw ArgumentError(
"Invalid blockChainNetworkEnvironmentSettings. It must be of type `EvmNetworkEnvironmentSettings`");
"Invalid blockChainNetworkEnvironmentSettings type. Expected: `EvmNetworkEnvironmentSettings`");
}
ethereumRpcClient.networkClient
.setUrl(blockChainNetworkEnvironmentSettings.chainUrl);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ class NearBlockChainService
TransferRequest transferRequest) async {
if (transferRequest is! NearTransferRequest) {
throw ArgumentError(
'Incorrect TransferRequest type. Must be `NearTransferRequest`');
'Incorrect TransferRequest type. Expected: `NearTransferRequest`');
}

final transactionInfo = await getTransactionInfo(
Expand Down Expand Up @@ -96,7 +96,7 @@ class NearBlockChainService
) async {
if (smartContractArguments is! NearBlockChainSmartContractArguments) {
throw ArgumentError(
"Incorrect Blockchain Smart Contract Arguments. Expected `NearBlockChainSmartContractArguments`");
"Incorrect smartContractArguments type. Expected: `NearBlockChainSmartContractArguments`");
}

final transactionInfo = await getTransactionInfo(
Expand Down Expand Up @@ -152,7 +152,7 @@ class NearBlockChainService
Future<String> getWalletBalance(AccountInfoRequest accountInfoRequest) async {
if (accountInfoRequest is! NearAccountInfoRequest) {
throw ArgumentError(
"Invalid accountInfoRequest. It must be of type `NearAccountInfoRequest`");
"Invalid accountInfoRequest type. Expected: `NearAccountInfoRequest`");
}
final res =
await nearRpcClient.getAccountBalance(accountInfoRequest.accountId);
Expand All @@ -168,7 +168,7 @@ class NearBlockChainService
if (blockChainNetworkEnvironmentSettings
is! NearNetworkEnvironmentSettings) {
throw ArgumentError(
"Invalid blockChainNetworkEnvironmentSettings. It must be of type `NearNetworkEnvironmentSettings`");
"Invalid blockChainNetworkEnvironmentSettings type. Expected: `NearNetworkEnvironmentSettings`");
}
nearRpcClient.networkClient
.setUrl(blockChainNetworkEnvironmentSettings.chainUrl);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ class PolygonBlockChainService implements BlockChainService {
Future<String> getWalletBalance(AccountInfoRequest accountInfoRequest) {
if (accountInfoRequest is! EvmAccountInfoRequest) {
throw ArgumentError(
"Invalid accountInfoRequest. It must be of type `EvmAccountInfoRequest`");
"Invalid accountInfoRequest type. Expected: `EvmAccountInfoRequest`");
}
return polygonRpcClient.getAccountBalance(accountInfoRequest.accountId);
}
Expand All @@ -99,7 +99,7 @@ class PolygonBlockChainService implements BlockChainService {
if (blockChainNetworkEnvironmentSettings
is! EvmNetworkEnvironmentSettings) {
throw ArgumentError(
"Invalid blockChainNetworkEnvironmentSettings. It must be of type `EvmNetworkEnvironmentSettings`");
"Invalid blockChainNetworkEnvironmentSettings type. Expected: `EvmNetworkEnvironmentSettings`");
}
polygonRpcClient.networkClient
.setUrl(blockChainNetworkEnvironmentSettings.chainUrl);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ class XRPBlockChainService implements BlockChainService {
Future<String> getWalletBalance(AccountInfoRequest accountInfoRequest) {
if (accountInfoRequest is! XrpAccountInfoRequest) {
throw ArgumentError(
"Invalid accountInfoRequest. It must be of type `XrpAccountInfoRequest`");
"Invalid accountInfoRequest type. Expected: `XrpAccountInfoRequest`");
}
return xrpRpcClient.getAccountBalance(accountInfoRequest.accountId);
}
Expand All @@ -85,7 +85,7 @@ class XRPBlockChainService implements BlockChainService {
if (blockChainNetworkEnvironmentSettings
is! XrpNetworkEnvironmentSettings) {
throw ArgumentError(
"Invalid blockChainNetworkEnvironmentSettings. It must be of type `XrpNetworkEnvironmentSettings`");
"Invalid blockChainNetworkEnvironmentSettings type. Expected: `XrpNetworkEnvironmentSettings`");
}
xrpRpcClient.networkClient
.setUrl(blockChainNetworkEnvironmentSettings.chainUrl);
Expand Down

0 comments on commit 50285cc

Please sign in to comment.