Skip to content

Commit

Permalink
fix: error throw
Browse files Browse the repository at this point in the history
  • Loading branch information
mciparelli committed Sep 19, 2023
1 parent f1da4f4 commit 59569f3
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 8 deletions.
16 changes: 9 additions & 7 deletions components/flight.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,15 @@ export default function Flight({ flight, canje, bgColor }) {
{ flightUid: flight.uid, fare: flight.fare },
getTax,
);
const milesDisplay = <>
{new Intl.NumberFormat("es-AR").format(
flight.fare.miles,
)}
{canje.id === fares.moneyClub && flight.fare.money &&
` + $${Math.floor(flight.fare.money / 1000)}K`}
</>;
const milesDisplay = (
<>
{new Intl.NumberFormat("es-AR").format(
flight.fare.miles,
)}
{canje.id === fares.moneyClub && flight.fare.money &&
` + $${Math.floor(flight.fare.money / 1000)}K`}
</>
);
return (
<tr class="text-slate-500 whitespace-nowrap">
<td class={`${bgColor} py-4 px-2`}>
Expand Down
3 changes: 2 additions & 1 deletion utils/smiles-api.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ const fetch = limiter.wrap(FetchRetry(globalThis.fetch, {
if (attempt > 3) return false;
const status = response?.status;
if (status === 452) {
const { error: errorMessage } = await response.json();
const response = await response.json();
const errorMessage = response.error ?? response.errorMessage;
if (!errorMessage.startsWith("TypeError")) throw new Error(errorMessage);
console.log(`retrying, attempt number ${attempt + 1}`);
return true;
Expand Down

0 comments on commit 59569f3

Please sign in to comment.