From 8d7e28af3167dd9990111ff61953cb464e4cb2c4 Mon Sep 17 00:00:00 2001 From: Chaitanya Potti Date: Thu, 25 Jul 2024 13:43:20 +0800 Subject: [PATCH] improve error msgs --- packages/modal/src/modalManager.ts | 4 ++-- packages/no-modal/src/noModal.ts | 2 +- packages/ui/src/loginModal.tsx | 1 + 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/packages/modal/src/modalManager.ts b/packages/modal/src/modalManager.ts index 76c5c1dea..366584758 100644 --- a/packages/modal/src/modalManager.ts +++ b/packages/modal/src/modalManager.ts @@ -303,7 +303,7 @@ export class Web3Auth extends Web3AuthNoModal implements IWeb3AuthModal { this.initializeInAppWallet(adapterName); } } catch (error) { - log.error(error, "error while initializing adapter"); + log.error(error, "error while initializing adapter ", adapterName); } }); @@ -371,7 +371,7 @@ export class Web3Auth extends Web3AuthNoModal implements IWeb3AuthModal { this.loginModal.addWalletLogins(adaptersConfig, { showExternalWalletsOnly: !!options?.showExternalWalletsOnly }); return undefined; }) - .catch((error) => log.error(error, "error while initializing adapter")); + .catch((error) => log.error(error, "error while initializing adapter", adapterName)); } else if (adapter.status === ADAPTER_STATUS.READY) { adaptersConfig[adapterName] = (this.modalConfig.adapters as Record)[adapterName]; this.loginModal.addWalletLogins(adaptersConfig, { showExternalWalletsOnly: !!options?.showExternalWalletsOnly }); diff --git a/packages/no-modal/src/noModal.ts b/packages/no-modal/src/noModal.ts index 033d98dd7..d85f10f21 100644 --- a/packages/no-modal/src/noModal.ts +++ b/packages/no-modal/src/noModal.ts @@ -179,7 +179,7 @@ export class Web3AuthNoModal extends SafeEventEmitter implements IWeb3Auth { }); } - return this.walletAdapters[adapterName].init({ autoConnect: this.cachedAdapter === adapterName }).catch((e) => log.error(e)); + return this.walletAdapters[adapterName].init({ autoConnect: this.cachedAdapter === adapterName }).catch((e) => log.error(e, adapterName)); }); await Promise.all(initPromises); if (this.status === ADAPTER_STATUS.NOT_READY) { diff --git a/packages/ui/src/loginModal.tsx b/packages/ui/src/loginModal.tsx index 2043ef818..7e8ef7c8d 100644 --- a/packages/ui/src/loginModal.tsx +++ b/packages/ui/src/loginModal.tsx @@ -314,6 +314,7 @@ class LoginModal extends SafeEventEmitter { }); } }); + // TODO: send adapter name in error listener.on(ADAPTER_EVENTS.ERRORED, (error: Web3AuthError) => { log.error("error", error, error.message); if (error.code === 5000) {