Skip to content

♿ fix(api): improve accessibility of error responses#779

Open
claude[bot] wants to merge 1 commit intomainfrom
assistant/accessibility-20260317-130132
Open

♿ fix(api): improve accessibility of error responses#779
claude[bot] wants to merge 1 commit intomainfrom
assistant/accessibility-20260317-130132

Conversation

@claude
Copy link
Contributor

@claude claude bot commented Mar 17, 2026

Summary

This PR improves developer accessibility by replacing raw exception strings with user-friendly, actionable messages in API error responses, while logging detailed errors server-side for debugging.

Changes

  • users.py: Add logging and user-friendly messages for user management errors
  • file.py: Add logging and user-friendly messages for file operation errors
  • openai.py: Add logging and user-friendly messages for OpenAI-compatible endpoints
  • workflow.py: Add logging and user-friendly messages for workflow operation errors
  • collection.py: Add logging and user-friendly messages for collection operation errors
  • Memory: Add accessibility issue and insight files documenting the pattern

Benefits

  • ✅ Provides clear, actionable error messages to users
  • ✅ Logs detailed errors server-side for debugging
  • ✅ Avoids exposure of internal implementation details
  • ✅ Maintains consistent error response format across all endpoints
  • ✅ Enhanced security by not exposing internals in production

Testing

  • All typecheck and lint checks pass
  • All API tests pass (file API, workflow API)
  • Full test suite: 4112 passed, 8 failed (pre-existing SERP provider issues unrelated to this change)

Example

# Before:
except Exception as e:
    raise HTTPException(status_code=500, detail=str(e)) from e

# After:
except Exception as e:
    log.error("Error listing files in %s: %s", path, e)
    raise HTTPException(
        status_code=500,
        detail="Failed to list files. Please check the path and try again.",
    ) from e

🤖 Generated with Claude Code

Replace raw exception strings with user-friendly, actionable messages
in API error responses while logging detailed errors server-side.

This improves developer accessibility by:
- Providing clear, actionable error messages to users
- Logging detailed errors server-side for debugging
- Avoiding exposure of internal implementation details
- Maintaining consistent error response format

Changes:
- users.py: Add logging and user-friendly messages for user management errors
- file.py: Add logging and user-friendly messages for file operation errors
- openai.py: Add logging and user-friendly messages for OpenAI-compatible endpoints
- workflow.py: Add logging and user-friendly messages for workflow operation errors
- collection.py: Add logging and user-friendly messages for collection operation errors
- Add accessibility issue and insight files to memory

All changes maintain existing functionality while improving the user experience.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
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.

0 participants