handle overflow

This commit is contained in:
mantikoros 2022-03-14 21:29:28 -05:00
parent 941d66b34c
commit 0a28ea52b6

View File

@ -110,6 +110,13 @@ export const placeBet = functions.runWith({ minInstances: 1 }).https.onCall(
newBetDoc.id
)
if (newP !== undefined && !isFinite(newP)) {
return {
status: 'error',
message: 'Trade rejected due to overflow error.',
}
}
transaction.create(newBetDoc, newBet)
transaction.update(