Skip to content

Commit 6c195a4

Browse files
committed
fix(developer): split auto-topup amount validation into separate error checks
1 parent e1e2321 commit 6c195a4

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

apps/web/actions/developers/update-auto-topup.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,10 @@ export async function updateDeveloperAutoTopUp(data: {
3535
) {
3636
throw new Error("Threshold must be non-negative");
3737
}
38-
if (
39-
data.amountCents !== undefined &&
40-
(data.amountCents <= 0 || data.amountCents > 100_000)
41-
) {
38+
if (data.amountCents !== undefined && data.amountCents <= 0) {
39+
throw new Error("Top-up amount must be positive");
40+
}
41+
if (data.amountCents !== undefined && data.amountCents > 100_000) {
4242
throw new Error("Top-up amount must be between $0.01 and $1,000.00");
4343
}
4444

0 commit comments

Comments
 (0)