refactor: prep the feedback cap error once instead of via a factory

Both throw sites are in one call and only one can ever run, so a plain
const reads the same and drops a function that existed only to defer a
constructor.
This commit is contained in:
jelveh
2026-08-11 22:11:24 -07:00
parent 25acf14c8b
commit 90cffbfcde
@@ -219,14 +219,13 @@ export class AppFeedbackService extends PuterService {
userCount >= AppFeedbackService.PER_USER_DAILY_LIMIT + slack
);
};
const tooManyError = () =>
new HttpError(
429,
'You have sent a lot of feedback recently — please try again later',
{ legacyCode: 'too_many_requests' },
);
const tooManyError = new HttpError(
429,
'You have sent a lot of feedback recently — please try again later',
{ legacyCode: 'too_many_requests' },
);
if (await capsBreached(false)) {
throw tooManyError();
throw tooManyError;
}
const row = await this.stores.appFeedback.create({
@@ -245,7 +244,7 @@ export class AppFeedbackService extends PuterService {
// hold.
if (await capsBreached(true)) {
await this.stores.appFeedback.deleteById(row.id);
throw tooManyError();
throw tooManyError;
}
// Email delivery is best-effort: any failure past this point must