Plain text SQL Interrupted errors in JSON responses

The SQL time limit error embedded an HTML fragment (paragraph, textarea
and script tags) as the error string in JSON responses. DatasetteError
now accepts a plain_message which the exception handler prefers for
JSON error bodies; the HTML error page keeps the rich message with the
SQL textarea.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GrHZSypDfMnym1tM5XJAFZ
This commit is contained in:
Claude 2026-07-06 23:34:17 +00:00
commit 0d962deb05
No known key found for this signature in database
7 changed files with 43 additions and 12 deletions

View file

@ -394,9 +394,11 @@ Concerns:
✅ Done — now 400 (fixed with §1b).
4. ~~**Row delete 500** (§1c) — inconsistent with every sibling endpoint.~~
✅ Done — now 400.
5. **The "SQL Interrupted" error embeds an HTML fragment in the JSON `error`
5. ~~**The "SQL Interrupted" error embeds an HTML fragment in the JSON `error`
value** (views/database.py:805-820). Error strings in the JSON API should
be plain text.
be plain text.~~ ✅ **Done**`DatasetteError` gained a `plain_message`
used for JSON responses; the HTML error page keeps the rich version with
the SQL textarea. §8 is now fully resolved.
---