datasette/datasette
Claude 8b159144a5
Add Response.error() for JSON errors in the standard format
Response.error(messages, status=400) builds a JSON error response in
Datasette's standard error format, alongside Response.json/html/text.
messages can be a single string or a list. All internal error response
construction now uses it - the private views.base._error() helper is
gone and the verbose Response.json(error_body(...), status=...) sites
are converted. error_body() remains for the cases that merge the error
keys into a larger payload (the JSON renderer, handle_exception and the
permission debug payload builders).

Since Response is public plugin API, plugins that build JSON endpoints
now have an obvious way to return errors in the canonical shape.
Documented in the internals documentation, including the guidance to
raise Forbidden/NotFound/BadRequest/DatasetteError instead when the
error should content-negotiate.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GrHZSypDfMnym1tM5XJAFZ
2026-07-06 23:48:49 +00:00
..
default_permissions Disallow update/delete of private queries 2026-05-26 14:10:48 -07:00
publish Get publish cloudrun working with latest Cloud Run (#2581) 2025-11-05 09:28:41 -08:00
static Merge remote-tracking branch 'origin/main' into edit-blobs 2026-07-03 17:25:41 -07:00
templates Unify page-size parameters on _size with table semantics 2026-07-04 17:54:03 +00:00
utils Add Response.error() for JSON errors in the standard format 2026-07-06 23:48:49 +00:00
views Add Response.error() for JSON errors in the standard format 2026-07-06 23:48:49 +00:00
__init__.py Merge remote-tracking branch 'origin/main' into claude/json-api-docs-1-0-review-a3e83u 2026-07-06 22:25:27 +00:00
__main__.py Add support for running datasette as a module (#556) 2019-07-11 09:07:44 -07:00
_pytest_plugin.py Fix to our pytest plugin to better support pytest-cov 2026-06-11 07:29:27 -07:00
actor_auth_cookie.py Remove python-baseconv dependency, refs #1733, closes #1734 2022-05-02 12:39:06 -07:00
app.py Add Response.error() for JSON errors in the standard format 2026-07-06 23:48:49 +00:00
blob_renderer.py Rename route match groups for consistency, refs #1667, #1660 2022-03-19 09:52:08 -07:00
cli.py datasette inspect now counts 10,000+ tables correctly (#2752) 2026-05-28 15:52:51 -07:00
column_types.py Refine column field plugin API and documentation 2026-06-14 15:09:24 -07:00
csrf.py Normalize headers in CSRF checks, refs #2689 2026-04-14 19:24:38 -07:00
database.py Fix for gen.throw(*sys.exc_info()) warning 2026-06-13 11:15:47 -07:00
default_actions.py Support CREATE VIEW / DROP VIEW in execute-write-sql 2026-07-02 08:56:04 -07:00
default_column_types.py textarea column type 2026-06-13 22:18:45 -07:00
default_database_actions.py No execute-write on immutable databases 2026-05-25 12:46:21 -07:00
default_debug_menu.py Autocomplete widget and /-/debug/autocomplete test page 2026-06-13 22:59:37 -07:00
default_jump_items.py Remove source and source_key columns from JumpSQL 2026-05-23 20:41:32 -07:00
default_magic_parameters.py Fix datetime.utcnow deprecation warning 2024-03-15 15:32:12 -07:00
default_query_actions.py Web UI to edit and delete stored queries (#2764) 2026-06-08 20:19:47 -07:00
default_table_actions.py Add alter table modal 2026-06-22 10:11:56 -07:00
events.py RenameTableEvent, plus write connection track_event() mechanism (#2682) 2026-03-30 11:20:46 -07:00
extras.py Return 400 for unknown _extra names on data formats 2026-07-04 16:16:02 +00:00
facets.py Renamed canned queries to queries / stored queries in docs 2026-05-26 15:17:51 -07:00
filters.py Fix type annotation bugs and remove unused imports 2025-10-26 16:03:13 -07:00
fixtures.py datasette.fixtures module, closes #2733 2026-05-21 23:05:37 -07:00
forbidden.py Add Response.error() for JSON errors in the standard format 2026-07-06 23:48:49 +00:00
handle_exception.py Plain text SQL Interrupted errors in JSON responses 2026-07-06 23:34:17 +00:00
hookspecs.py Support for <button> items in action menus 2026-06-14 15:58:37 -07:00
inspect.py Black formatting 2026-02-17 13:30:24 -08:00
jump.py JumpSQL(database=) parameter 2026-05-23 21:00:04 -07:00
permissions.py Request-scoped permission check cache 2026-06-12 13:11:17 -07:00
plugins.py Add alter table modal 2026-06-22 10:11:56 -07:00
renderer.py Unify JSON error responses into one canonical shape 2026-07-04 03:12:15 +00:00
resources.py Rename canned queries to queries/stored queries in docs 2026-05-26 14:54:35 -07:00
sql_functions.py _search= queries now correctly escaped, fixes #651 2019-12-29 18:48:30 +00:00
stored_queries.py Remove has_more from query list JSON - next: null signals the end 2026-07-06 23:02:42 +00:00
template_contexts.py Clarify template context metadata names 2026-06-23 11:30:30 -07:00
tokens.py Return 401 for invalid or expired bearer tokens 2026-07-04 15:18:12 +00:00
tracer.py Fix for trace_child_tasks exception handling 2026-06-12 13:21:58 -07:00
url_builder.py count all rows button on table page, refs #2408 2024-08-21 19:09:25 -07:00
version.py Release 1.0a35 2026-06-23 14:30:08 -07:00
write_sql.py Support CREATE VIEW / DROP VIEW in execute-write-sql 2026-07-02 08:56:04 -07:00