Skip to content
This repository was archived by the owner on Jul 6, 2022. It is now read-only.

Commit 3757c97

Browse files
committed
fix: 🐛 add more descriptive ErrorCodes
1 parent fe5056c commit 3757c97

File tree

2 files changed

+5
-8
lines changed

2 files changed

+5
-8
lines changed

src/contract_wrappers/modules/checkpoint/dividend_checkpoint_wrapper.ts

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -583,11 +583,7 @@ export default abstract class DividendCheckpointWrapper extends ModuleWrapper {
583583
) => {
584584
excluded.forEach(address => assert.isNonZeroETHAddressHex('Excluded address', address));
585585
assert.areThereDuplicatedStrings('Excluded addresses', excluded);
586-
assert.assert(
587-
excluded.length <= EXCLUDED_ADDRESS_LIMIT,
588-
ErrorCode.InvalidLenghtLimit,
589-
'Too many addresses excluded',
590-
);
586+
assert.assert(excluded.length <= EXCLUDED_ADDRESS_LIMIT, ErrorCode.ArrayTooLarge, 'Too many addresses excluded');
591587
assert.assert(expiry > maturity, ErrorCode.TooLate, 'Expiry before maturity');
592588
assert.isFutureDate(expiry, 'Expiry in past');
593589
assert.isBigNumberGreaterThanZero(amount, 'No dividend sent');
@@ -608,12 +604,12 @@ export default abstract class DividendCheckpointWrapper extends ModuleWrapper {
608604
const erc20TokenAllowance = await erc20Detailed.allowance.callAsync(callerAddress, await this.address());
609605
assert.assert(
610606
erc20TokenAllowance.isGreaterThanOrEqualTo(amount),
611-
ErrorCode.InvalidData,
607+
ErrorCode.InsufficientAllowance,
612608
'Your allowance is less than dividend amount',
613609
);
614610
assert.assert(
615611
erc20TokenBalance.isGreaterThanOrEqualTo(amount),
616-
ErrorCode.InvalidData,
612+
ErrorCode.InsufficientBalance,
617613
'Your balance is less than dividend amount',
618614
);
619615
} else {

src/types.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -354,7 +354,8 @@ export enum ErrorCode {
354354
AddressExcluded = 'AddressExcluded',
355355
InvalidDividend = 'InvalidDividend',
356356
InvalidCheckpoint = 'InvalidCheckpoint',
357-
InvalidLenghtLimit = 'InvalidLenghtLimit',
357+
ArrayTooLarge = 'ArrayTooLarge',
358358
InvalidBound = 'InvalidBound',
359359
InvalidDelegate = 'InvalidDelegate',
360+
InsufficientAllowance = 'InsufficientAllowance',
360361
}

0 commit comments

Comments
 (0)