diff --git a/README.md b/README.md index 129b144..5a58bef 100644 --- a/README.md +++ b/README.md @@ -73,6 +73,9 @@ function App() { .reject((error) => { // You MUST handle the reject because once the user closes the modal, peraWallet.connect() promise will be rejected. // For the async/await syntax you MUST use try/catch + if (error?.data?.type !== "CONNECT_MODAL_CLOSED") { + // log the necessary errors + } }); } diff --git a/src/modal/peraWalletConnectModalUtils.tsx b/src/modal/peraWalletConnectModalUtils.tsx index 64395d4..66482c9 100644 --- a/src/modal/peraWalletConnectModalUtils.tsx +++ b/src/modal/peraWalletConnectModalUtils.tsx @@ -54,9 +54,9 @@ function openPeraWalletConnectModal(rejectPromise?: (error: any) => void) { rejectPromise( new PeraWalletConnectError( { - type: "SESSION_CONNECT" + type: "CONNECT_MODAL_CLOSED" }, - "The action canceled by the user." + "The modal has been closed by the user." ) ); } diff --git a/src/util/PeraWalletConnectError.ts b/src/util/PeraWalletConnectError.ts index 224583b..c7d4964 100644 --- a/src/util/PeraWalletConnectError.ts +++ b/src/util/PeraWalletConnectError.ts @@ -4,7 +4,8 @@ interface PeraWalletConnectErrorData { | "SESSION_DISCONNECT" | "SESSION_UPDATE" | "SESSION_CONNECT" - | "SESSION_RECONNECT"; + | "SESSION_RECONNECT" + | "CONNECT_MODAL_CLOSED"; detail?: any; }