Improve qualification of rest errors (#17629)
Will help close [sentry](https://twenty-v7.sentry.io/issues/6827612895/?environment=prod&environment=prod-eu&project=4507072499810304&query=is%3Aunresolved%20%21issue.type%3A%5Bperformance_consecutive_db_queries%2Cperformance_consecutive_http%2Cperformance_file_io_main_thread%2Cperformance_db_main_thread%2Cperformance_n_plus_one_db_queries%2Cperformance_n_plus_one_api_calls%2Cperformance_p95_endpoint_regression%2Cperformance_slow_db_query%2Cperformance_render_blocking_asset_span%2Cperformance_uncompressed_assets%2Cperformance_http_overhead%2Cperformance_large_http_payload%5D%20timesSeen%3A%3E10&referrer=issue-stream&sort=date): a 400 error (attempt to filter on a `null` id) qualified as a 500 error from rest api. I don't know what was our long term plan on validation for rest api, I suppose it's not a priority, making it acceptable to interceipt some postgres errors based on their messages. Ideally we would have a validation earlier, at args parsing level. before <img width="1286" height="460" alt="Capture d’écran 2026-02-02 à 14 08 53" src="https://github.com/user-attachments/assets/bf3d34f9-1436-4739-8f8e-95b18f59045b" /> after <img width="1222" height="438" alt="Capture d’écran 2026-02-02 à 14 09 01" src="https://github.com/user-attachments/assets/e817eaff-1ab9-49fb-869d-ddfd00671fbf" />
This commit is contained in:
+2
-2
@@ -6,7 +6,7 @@ exports[`Create input validation - DATE Gql create input - failure DATE - should
|
||||
|
||||
exports[`Create input validation - DATE Gql create input - failure DATE - should fail with : {"dateField":{}} 1`] = `"Invalid value {} for date or date-time field "dateField""`;
|
||||
|
||||
exports[`Create input validation - DATE Gql create input - failure DATE - should fail with : {"dateField":1} 1`] = `"invalid input syntax for type date: "1""`;
|
||||
exports[`Create input validation - DATE Gql create input - failure DATE - should fail with : {"dateField":1} 1`] = `"Data validation error."`;
|
||||
|
||||
exports[`Create input validation - DATE Gql create input - failure DATE - should fail with : {"dateField":true} 1`] = `"Invalid value true for date or date-time field "dateField""`;
|
||||
|
||||
@@ -16,6 +16,6 @@ exports[`Create input validation - DATE Rest create input - failure DATE - shoul
|
||||
|
||||
exports[`Create input validation - DATE Rest create input - failure DATE - should fail with : {"dateField":{}} 1`] = `"["Invalid value {} for date or date-time field \\"dateField\\""]"`;
|
||||
|
||||
exports[`Create input validation - DATE Rest create input - failure DATE - should fail with : {"dateField":1} 1`] = `"["invalid input syntax for type date: \\"1\\""]"`;
|
||||
exports[`Create input validation - DATE Rest create input - failure DATE - should fail with : {"dateField":1} 1`] = `"["Data validation error."]"`;
|
||||
|
||||
exports[`Create input validation - DATE Rest create input - failure DATE - should fail with : {"dateField":true} 1`] = `"["Invalid value true for date or date-time field \\"dateField\\""]"`;
|
||||
|
||||
Reference in New Issue
Block a user