Skip to content

fix: clean error message for Anthropic API failures in image generation#72

Open
meninoebom wants to merge 1 commit into
mainfrom
meninoebom/clean-image-error-msg
Open

fix: clean error message for Anthropic API failures in image generation#72
meninoebom wants to merge 1 commit into
mainfrom
meninoebom/clean-image-error-msg

Conversation

@meninoebom
Copy link
Copy Markdown
Owner

Summary

  • str(anthropic.APIError) dumps the full JSON response body (type, message, request_id) — this was leaking raw API internals into the UI as "Visualizer error: Error code: 400 - {'type': 'error', ...}"
  • Switch to e.message which is just the human-readable string (e.g. "Your credit balance is too low to access the Anthropic API.")

Test plan

  • Existing test test_claude_visualizer_wraps_api_errors still passes (confirmed locally)
  • Trigger image generation with an invalid/exhausted API key — error panel should now show a clean sentence instead of raw JSON

🤖 Generated with Claude Code

…tion

str(anthropic.APIError) dumps the full JSON response body including
request_id and error type fields. Use e.message instead to surface
only the human-readable text in the 503 error detail.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@railway-app
Copy link
Copy Markdown

railway-app Bot commented Apr 28, 2026

🚅 Deployed to the breadcrumbs-pr-72 environment in Breadcrumbs

Service Status Web Updated (UTC)
Breadcrumbs Web App Server ✅ Success (View Logs) Web Apr 28, 2026 at 1:39 am

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