Skip to content

Commit

Permalink
feat: throw error if many currencyId
Browse files Browse the repository at this point in the history
  • Loading branch information
CremaFR committed Sep 3, 2024
1 parent 289f9ba commit 3e857a6
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion libs/ledger-live-common/src/exchange/providers/swap.ts
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,10 @@ export const findExchangeCurrencyData = async (
});
// TODO: maybe throw errors/warning if many currencies fetched with the same ID.
if (!currencyData.length) {
throw new Error(`Currency data not found for id ${currencyId}`);
throw new Error(`Exchange, missing configuration for ${currencyId}`);
}
if (currencyData.length !== 1) {
throw new Error(`Exchange, multiple configurations found for ${currencyId}`);
}
return {
id: currencyData[0].id,
Expand Down

0 comments on commit 3e857a6

Please sign in to comment.