-
Notifications
You must be signed in to change notification settings - Fork 35
feat: add user-friendly error messages #437
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: add user-friendly error messages #437
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This pull request adds a user-friendly error handling system to transform cryptic error messages into helpful, actionable guidance for CLI users. The changes include a new errors module with pattern-based error matching and user-friendly formatting, integration into the existing error handling paths, and comprehensive test coverage.
- Introduces
UserFriendlyErrordataclass andErrorCategoryenum for structured error representation - Implements pattern-based error matching for 13+ error scenarios including connection, authentication, permissions, timeouts, and more
- Updates
app.pyandsettings.pyto use the new error formatting system
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 7 comments.
Show a summary per file
| File | Description |
|---|---|
| src/pieces/errors/init.py | Exports the public API of the new errors module |
| src/pieces/errors/user_friendly.py | Core implementation with error patterns, matching logic, and formatting |
| src/pieces/app.py | Updates main exception handler to use user-friendly error formatting |
| src/pieces/settings.py | Updates show_error method to handle both Exception objects and string errors with user-friendly formatting |
| tests/test_user_friendly_errors.py | Comprehensive test suite with 19 tests covering error categorization and formatting |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
…re pattern matching - use getattr for safer errno access - remove unused EXCEPTION_HANDLERS code
bishoy-at-pieces
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Super solid thank you so much
Just small change needed
Replace hardcoded documentation URLs with references to the URLs enum class as requested by maintainer. This ensures URLs are centralized and can be updated in one place.
What this does
Transforms cryptic error messages into helpful guidance. Instead of showing users raw exceptions like
WebSocket connection failed: [Errno 61] Connection refused, they now see what went wrong, why it might have happened, and what to try.Example
Before:
Error: WebSocket connection failed: [Errno 61] Connection refusedAfter:
Changes:
Fixes #379