Skip to content

Commit b561946

Browse files
committed
fix: error throwing
1 parent 7e5a6fc commit b561946

2 files changed

Lines changed: 6 additions & 4 deletions

File tree

constants/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,10 +47,10 @@ export const RESPONSE_MESSAGES = {
4747
FAILED_TO_FETCH_PRICE_FROM_API_500: (day: string, ticker: string) => { return { statusCode: 500, message: `Failed to fetch ${ticker} price for day ${day}` } },
4848
MISSING_WS_AUTH_KEY_400: { statusCode: 400, message: 'Missing WS_AUTH_KEY environment variable' },
4949
MISSING_PRICE_FOR_TRANSACTION_400: { statusCode: 400, message: 'Missing price for transaction.' },
50-
INVALID_PRICES_AMOUNT_FOR_TX_ON_CSV_CREATION_500: (pricesLenght: number, groupKey: string, tempTxGroupLength: number, uniquePricesIds: string) => {
50+
INVALID_PRICES_AMOUNT_FOR_TX_ON_CSV_CREATION_500: (pricesLenght: number) => {
5151
return {
5252
statusCode: 500,
53-
message: `Error processing ${groupKey} batch, Got wrong number of prices for transactions group (${tempTxGroupLength}) in CSV creation. Expected 1, got ${pricesLenght}. Prices Ids ${uniquePricesIds}`
53+
message: `Got wrong number of prices for transactions group in CSV creation. Expected 1, got ${pricesLenght}.`
5454
}
5555
},
5656
INVALID_PRICE_STATE_400: { statusCode: 400, message: 'Missing expected quote price for transaction.' },

utils/files.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -153,12 +153,14 @@ export const collapseSmallPayments = (
153153
nonUniquePrices.forEach(nonUniquePrice => {
154154
txsForPrice[nonUniquePrice] = tempTxGroup.filter(tx => nonUniquePrice === tx.prices.find(p => p.price.quoteId === quoteId)!.price.value.toNumber()).map(tx => tx.id)
155155
})
156-
console.error('ERROR WHEN TRYING TO COLLAPSE TXS INTO DIFFERENT PRICES:', { txsForPrice })
156+
console.error('ERROR WHEN TRYING TO COLLAPSE TXS INTO DIFFERENT PRICES:', { txsForPrice, nonUniquePrices })
157+
} else {
158+
console.error('ERROR WHEN TRYING TO COLLAPSE TXS INTO DIFFERENT PRICES, NO PRICES FOR GROUP KEY', { groupKey })
157159
}
158160

159161
throw new Error(
160162
RESPONSE_MESSAGES
161-
.INVALID_PRICES_AMOUNT_FOR_TX_ON_CSV_CREATION_500(uniquePrices.size, groupKey, tempTxGroup.length, [...uniquePrices].join(',')).message
163+
.INVALID_PRICES_AMOUNT_FOR_TX_ON_CSV_CREATION_500(tempTxGroup.length).message
162164
)
163165
}
164166
const rate = new Prisma.Decimal(uniquePrices.values().next().value as number)

0 commit comments

Comments
 (0)