Files
twenty/packages/twenty-server
Sonarly Claude CodeandClaude Opus 4.6 ee73f8a087 fix: handle foreign key violations as 400 Bad Request instead of 500
Foreign key constraint violations (PostgreSQL error 23503) from user input
(e.g., POST /rest/people with a non-existent companyId) were falling through
to the generic PostgresException catch-all, which returned a 500 Internal
Server Error with an unhelpful "Data validation error." message.

Add a specific handler for FOREIGN_KEY_VIOLATION that returns a TwentyORMException
with INVALID_INPUT code, resulting in a 400 Bad Request with a descriptive message.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-20 00:34:28 +00:00
..