Skip to content

Return translate/simplify upload failures as JSON (make_error), 422#661

Merged
mircealungu merged 1 commit into
masterfrom
fix/translate-simplify-json-errors
Jul 2, 2026
Merged

Return translate/simplify upload failures as JSON (make_error), 422#661
mircealungu merged 1 commit into
masterfrom
fix/translate-simplify-json-errors

Conversation

@mircealungu

Copy link
Copy Markdown
Member

Follow-up to #660.

The user-initiated conversion endpoints (/article_upload/<id>/translate_and_adapt, /simplify) reported failure with flask.abort(...), which renders an HTML error page. The web client does response.json() on errors, so it never saw the message and fell back to HTTP 4xx / a hardcoded generic.

Switch both to make_error(status, msg) (the repo's jsonify({"message": ...}) helper) so the actionable text — "…too long to process in one piece — try importing a single chapter" — reaches the reader.

Also drops the simplify failure from 500 to 422 to match translate: an over-long upload is a content issue, not a server fault, and shouldn't page on-call.

Pairs with zeeguu/web#1183, which updates the reader to display the message.

🤖 Generated with Claude Code

These user-initiated conversion failures used flask.abort, which renders HTML,
so the web client's response.json() failed and it could only show "HTTP 4xx" /
a hardcoded generic. Switch to make_error (jsonify {message}) so the actionable
text ("…too long… try a single chapter") reaches the reader.

Also drops simplify from 500 to 422 to match translate: an over-long upload is
a content issue, not a server fault, and shouldn't page on-call.

Pairs with zeeguu/web#1183 (reader surfaces the message).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@github-actions

github-actions Bot commented Jul 2, 2026

Copy link
Copy Markdown

ArchLens detected architectural changes in the following views:
diff

@mircealungu mircealungu merged commit c5c53d0 into master Jul 2, 2026
2 of 3 checks passed
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