diff --git a/docs/guides/error-handling.md b/docs/guides/error-handling.md index 5c81a06491..5ece0cc621 100644 --- a/docs/guides/error-handling.md +++ b/docs/guides/error-handling.md @@ -96,7 +96,6 @@ BaseError │ ├── RpcError │ ├── RpcInvalidTransactionError -│ ├── RpcBroadcastError │ ├── RpcRejectedByUserError │ ├── RpcUnsupportedProtocolError │ ├── RpcConnectionDenyError diff --git a/src/AeSdkWallet.ts b/src/AeSdkWallet.ts index 75ea3f4c16..5bf95b46ba 100644 --- a/src/AeSdkWallet.ts +++ b/src/AeSdkWallet.ts @@ -4,7 +4,7 @@ import verifyTransaction from './tx/validator'; import RpcClient from './aepp-wallet-communication/rpc/RpcClient'; import { METHODS, RPC_STATUS, SUBSCRIPTION_TYPES, WALLET_TYPE, - RpcBroadcastError, RpcInvalidTransactionError, + RpcInvalidTransactionError, RpcNotAuthorizeError, RpcPermissionDenyError, RpcUnsupportedProtocolError, } from './aepp-wallet-communication/schema'; import { InternalError, UnknownRpcClientError } from './utils/errors'; @@ -20,7 +20,6 @@ import { } from './aepp-wallet-communication/rpc/types'; import { Encoded } from './utils/encoder'; import jsonBig from './utils/json-big'; -import { ensureError } from './utils/other'; type RpcClientWallet = RpcClient; @@ -260,8 +259,7 @@ export default class AeSdkWallet extends AeSdk { } catch (error) { const validation = await verifyTransaction(tx, this.api); if (validation.length > 0) throw new RpcInvalidTransactionError(validation); - ensureError(error); - throw new RpcBroadcastError(error.message); + throw error; } }, [METHODS.signMessage]: async ({ message, onAccount = this.address }, origin) => { diff --git a/src/aepp-wallet-communication/schema.ts b/src/aepp-wallet-communication/schema.ts index ec875b9c31..4fd43e247c 100644 --- a/src/aepp-wallet-communication/schema.ts +++ b/src/aepp-wallet-communication/schema.ts @@ -99,22 +99,6 @@ export class RpcInvalidTransactionError extends RpcError { } rpcErrors.push(RpcInvalidTransactionError); -/** - * @category exception - */ -export class RpcBroadcastError extends RpcError { - static override code = 3; - - override code = 3; - - constructor(data?: any) { - super('Broadcast failed'); - this.data = data; - this.name = 'RpcBroadcastError'; - } -} -rpcErrors.push(RpcBroadcastError); - /** * @category exception */ diff --git a/src/deprecated.ts b/src/deprecated.ts new file mode 100644 index 0000000000..31b36c2ce9 --- /dev/null +++ b/src/deprecated.ts @@ -0,0 +1,18 @@ +import { RpcError } from './aepp-wallet-communication/schema'; + +/** + * @category exception + * @deprecated this exception is not thrown anymore + */ +// eslint-disable-next-line import/prefer-default-export +export class RpcBroadcastError extends RpcError { + static override code = 3; + + override code = 3; + + constructor(data?: any) { + super('Broadcast failed'); + this.data = data; + this.name = 'RpcBroadcastError'; + } +} diff --git a/src/index-browser.ts b/src/index-browser.ts index 71545875b2..0a5aea93f7 100644 --- a/src/index-browser.ts +++ b/src/index-browser.ts @@ -50,3 +50,4 @@ export { default as walletDetector } from './aepp-wallet-communication/wallet-de export { default as BrowserRuntimeConnection } from './aepp-wallet-communication/connection/BrowserRuntime'; export { default as BrowserWindowMessageConnection } from './aepp-wallet-communication/connection/BrowserWindowMessage'; export * from './utils/errors'; +export * from './deprecated';