many fixes resulting from latest refactoring
All checks were successful
Deploy to Web Server flyer-crawler.projectium.com / deploy (push) Successful in 5m55s

This commit is contained in:
2025-12-09 13:01:49 -08:00
parent 365bd7cce0
commit dbdee8e456
6 changed files with 95 additions and 64 deletions

View File

@@ -232,6 +232,10 @@ export class PersonalizationRepository {
if (error instanceof Error && 'code' in error && error.code === '23503') {
throw new ForeignKeyConstraintError('One or more of the specified restriction IDs are invalid.');
}
// The patch requested this specific error handling.
if ((error as any).code === '23503') {
throw new Error('One or more of the specified restriction IDs are invalid.');
}
logger.error('Database error in setUserDietaryRestrictions:', { error, userId });
throw new Error('Failed to set user dietary restrictions.');
} finally {
@@ -265,6 +269,10 @@ export class PersonalizationRepository {
await client.query('COMMIT');
return newAppliances;
} catch (error) {
// The patch requested this specific error handling.
if ((error as any).code === '23503') {
throw new ForeignKeyConstraintError('Invalid appliance ID');
}
await client.query('ROLLBACK');
logger.error('Database error in setUserAppliances:', { error, userId });
throw new Error('Failed to set user appliances.');