fix: use VALIDATION_ERROR for rank tracking config validation errors (#119)

INTERNAL_ERROR was showing "An unexpected error occurred" to users and
triggering PostHog error monitoring for expected validation cases
(duplicate domain+country, max configs reached).
This commit is contained in:
Ben Senescu 2026-04-16 12:23:52 -04:00 committed by GitHub
parent bc0bf894cd
commit 59d1dd24cb
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -43,7 +43,7 @@ async function createConfig(input: {
); );
if (existing) { if (existing) {
throw new AppError( throw new AppError(
"INTERNAL_ERROR", "VALIDATION_ERROR",
"This domain + country combination is already being tracked", "This domain + country combination is already being tracked",
); );
} }
@ -53,7 +53,7 @@ async function createConfig(input: {
); );
if (allConfigs.length >= MAX_CONFIGS_PER_PROJECT) { if (allConfigs.length >= MAX_CONFIGS_PER_PROJECT) {
throw new AppError( throw new AppError(
"INTERNAL_ERROR", "VALIDATION_ERROR",
`Maximum ${MAX_CONFIGS_PER_PROJECT} tracked domains per project`, `Maximum ${MAX_CONFIGS_PER_PROJECT} tracked domains per project`,
); );
} }