Skip to content

Commit

Permalink
refactor(core-magistrate-transactions): BridgechainUpdate errors (#3141)
Browse files Browse the repository at this point in the history
  • Loading branch information
Lemii authored and spkjp committed Nov 21, 2019
1 parent 3b026d6 commit 8d8bb74
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
8 changes: 7 additions & 1 deletion packages/core-magistrate-transactions/src/errors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export class BusinessIsNotRegisteredError extends Errors.TransactionError {

export class WalletIsNotBusinessError extends Errors.TransactionError {
constructor() {
super(`Failed to apply bridgechain transaction, because wallet is not a business.`);
super(`Failed to apply transaction, because wallet is not a business.`);
}
}

Expand All @@ -37,6 +37,12 @@ export class BridgechainAlreadyRegisteredError extends Errors.TransactionError {
}
}

export class BridgechainIsNotRegisteredByWalletError extends Errors.TransactionError {
constructor() {
super(`Failed to apply transaction, because bridgechain is not registered by wallet.`);
}
}

export class BridgechainIsResignedError extends Errors.TransactionError {
constructor() {
super(`Failed to apply transaction, because bridgechain is resigned.`);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { Handlers, TransactionReader } from "@arkecosystem/core-transactions";
import { Interfaces, Managers, Transactions } from "@arkecosystem/crypto";

import {
BridgechainIsNotRegisteredError,
BridgechainIsNotRegisteredByWalletError,
BridgechainIsResignedError,
BusinessIsNotRegisteredError,
BusinessIsResignedError,
Expand Down Expand Up @@ -81,7 +81,7 @@ export class BridgechainUpdateTransactionHandler extends Handlers.TransactionHan
businessAttributes.bridgechains[bridgechainUpdate.bridgechainId.toFixed()];

if (!bridgechainAttributes) {
throw new BridgechainIsNotRegisteredError();
throw new BridgechainIsNotRegisteredByWalletError();
}

if (bridgechainAttributes.resigned) {
Expand Down

0 comments on commit 8d8bb74

Please sign in to comment.