Skip to content

armgit / Cap

Public Imported from GitHub
0

Open source Loom alternative. Beautiful, shareable screen recordings.

fix(developer): split auto-topup amount validation into separate error checks

Richie McIlroy6c195a468ed0
diff --git a/apps/web/actions/developers/update-auto-topup.ts b/apps/web/actions/developers/update-auto-topup.ts
index 1d5fb37fc..fa50d4c7a 100644
--- a/apps/web/actions/developers/update-auto-topup.ts
+++ b/apps/web/actions/developers/update-auto-topup.ts
@@ -35,10 +35,10 @@ export async function updateDeveloperAutoTopUp(data: {
) {
throw new Error("Threshold must be non-negative");
}
- if (
- data.amountCents !== undefined &&
- (data.amountCents <= 0 || data.amountCents > 100_000)
- ) {
+ if (data.amountCents !== undefined && data.amountCents <= 0) {
+ throw new Error("Top-up amount must be positive");
+ }
+ if (data.amountCents !== undefined && data.amountCents > 100_000) {
throw new Error("Top-up amount must be between $0.01 and $1,000.00");
}