Skip to content

Commit

Permalink
improve error handling
Browse files Browse the repository at this point in the history
  • Loading branch information
AyushBherwani1998 committed Jul 5, 2024
1 parent c4d8175 commit dc07b50
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 6 deletions.
16 changes: 12 additions & 4 deletions tkey-web/tkey-solana-example/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -262,8 +262,12 @@ function App() {
return;
}

const signedMessage = await solanaRpc.requestFaucet();
uiConsole(signedMessage);
try {
const signedMessage = await solanaRpc.requestFaucet();
uiConsole(signedMessage);
} catch (e) {
uiConsole(e?.toString());
}
};

const sendTransaction = async () => {
Expand All @@ -272,8 +276,12 @@ function App() {
return;
}

const signedMessage = await solanaRpc.sendTransaction();
uiConsole(signedMessage);
try {
const signedMessage = await solanaRpc.sendTransaction();
uiConsole(signedMessage);
} catch (e) {
uiConsole(e);
}
};

const criticalResetAccount = async (): Promise<void> => {
Expand Down
4 changes: 2 additions & 2 deletions tkey-web/tkey-solana-example/src/SolanaRPC.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ export default class SolanaRPC {

return hash.signature;
} catch (error) {
return error as string;
throw error;
}
}

Expand All @@ -92,7 +92,7 @@ export default class SolanaRPC {
const hash = await connection.requestAirdrop(publicKey, LAMPORTS_PER_SOL);
return hash;
} catch (error) {
return error as string;
throw error;
}
}

Expand Down

0 comments on commit dc07b50

Please sign in to comment.