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:
parent
bc0bf894cd
commit
59d1dd24cb
@ -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`,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user