Skip to content

Commit c055ef6

Browse files
os-zhuangclaude
andcommitted
chore: add changeset for rest 4xx error mapping
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent 746ca4f commit c055ef6

1 file changed

Lines changed: 15 additions & 0 deletions

File tree

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
---
2+
'@objectstack/rest': patch
3+
---
4+
5+
fix(rest): map schema-mismatch & not-null driver errors to structured 4xx
6+
7+
`mapDataError` collapsed any SQL-looking driver error into a generic
8+
`500 DATABASE_ERROR`, so a bad write payload to the data API leaked a 500
9+
instead of a fixable 4xx (e.g. `POST /data/sys_team` with an unknown field,
10+
or omitting a required column). It now maps unknown-column errors to
11+
`400 INVALID_FIELD { field }` and not-null violations to
12+
`400 VALIDATION_FAILED { fields:[{required}] }` across SQLite/Postgres/MySQL
13+
phrasings, placed before the unknown-object branch so Postgres
14+
`column … of relation … does not exist` is not mis-mapped to 404. Genuine
15+
driver faults still return 500; unique violations still return 409.

0 commit comments

Comments
 (0)