Skip to content

Commit

Permalink
fix: throw error
Browse files Browse the repository at this point in the history
  • Loading branch information
whilefoo committed Sep 30, 2024
1 parent 7030020 commit ee89f7d
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions static/scripts/ubiquity-dollar/transaction-history.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@ import { toaster } from "../rewards/toaster";
export function showTransactionHistory() {
const transactionHistory = document.getElementById("transaction-history");
if (!transactionHistory) {
console.error("Missing check div #transaction-history");
return;
throw new Error("Could not find transaction-history element");
}
const txs = Storage.loadTransactions().filter((tx) => tx.date.getTime() > Date.now() - 1000 * 60 * 60 * 24 * 7);
if (txs.length === 0) {
Expand All @@ -31,11 +30,11 @@ export function showTransactionHistory() {

txs.forEach((tx) => {
if (!tx.txHash) {
return;
throw new Error("Could not find txHash");
}
const button = document.getElementById(tx.txHash);
if (!button) {
return;
throw new Error("Could not find button");
}
button.addEventListener("click", async () => {
button.setAttribute("data-loading", "true");
Expand Down Expand Up @@ -77,7 +76,7 @@ function transactionRowHtml(transaction: Transaction) {

async function checkTransaction(transaction: Transaction) {
if (!transaction.txHash || !transaction.walletAddress || !transaction.chainId || !transaction.country || !transaction.productId) {
return;
throw new Error("Unexpected error");
}
const orderId = getGiftCardOrderId(transaction.walletAddress, transaction.txHash);
const response = await getOrder({ orderId });
Expand Down

0 comments on commit ee89f7d

Please sign in to comment.