Skip to content

Commit 2b20c17

Browse files
committed
chore: show detailed on-chain fetch errors
1 parent 582b47f commit 2b20c17

1 file changed

Lines changed: 16 additions & 2 deletions

File tree

app/ClientPage.tsx

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -786,8 +786,22 @@ export default function ClientPage() {
786786
}
787787

788788
setStatus("On-chain data refreshed");
789-
} catch {
790-
setError("Failed to fetch on-chain data.");
789+
} catch (err) {
790+
const message =
791+
err instanceof Error
792+
? err.message
793+
: typeof err === "string"
794+
? err
795+
: "Unknown error";
796+
797+
// Common foot-gun: wallet on testnet while app is set to mainnet (or vice-versa).
798+
const networkHint =
799+
(STACKS_NETWORK === "mainnet" && sender.startsWith("ST")) ||
800+
(STACKS_NETWORK === "testnet" && sender.startsWith("SP"))
801+
? " (Wallet/network mismatch: switch Leather network to match the app.)"
802+
: "";
803+
804+
setError(`Failed to fetch on-chain data: ${message}${networkHint}`);
791805
} finally {
792806
setIsLoading(false);
793807
}

0 commit comments

Comments
 (0)