Skip to content

fix: return JSON error for extension endpoint exceptions - #2321

Open
pike00 wants to merge 2 commits into
beancount:mainfrom
pike00:main
Open

fix: return JSON error for extension endpoint exceptions#2321
pike00 wants to merge 2 commits into
beancount:mainfrom
pike00:main

Conversation

@pike00

@pike00 pike00 commented Jul 27, 2026

Copy link
Copy Markdown
Contributor

Previously an exception in an extension endpoint bubbled up to Flask's default HTML 500 page, making it hard for extension UIs to show a friendly message. Wrap endpoint handler calls and return a JSON object with error details.

This is a small, focused change that makes the extension system more usable for JS-heavy extensions (like those using Preact/htm) that can't easily parse an HTML error page.

Will Pike added 2 commits July 26, 2026 20:19
Previously an exception in an extension endpoint bubbled up to Flask's default HTML 500 page, making it hard for extension UIs to show a friendly message. Wrap endpoint handler calls and return a JSON object with error details.
Previously an exception in an extension endpoint bubbled up to Flask's default HTML 500 page, making it hard for extension UIs to show a friendly message. Wrap endpoint handler calls and return a JSON object with error details.

- Catch Exception in extension_endpoint route, log with log.exception, return JSON with error/extension/endpoint keys and 500 status
- Add example_error endpoint to FavaExtTest for testing
- Add test_load_extension_endpoint_error test
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant