Implement miette library for enhanced CLI error reporting #45
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR refactors the CLI error handling to use the miette library for rich, user-friendly error reporting. The changes provide better error messages with diagnostic codes, helpful suggestions, and improved formatting.
Changes Made
Dependencies
miettedependency withfancyfeature for enhanced error formattingError Type Improvements
ConfigErrorwith miette diagnostic attributes and helpful suggestionsFormatErrorwith diagnostic codes and context-aware help messagesroughly::config::invalid,roughly::format::syntax)CLI Error Reporting
report_diagnostic_error()function for consistent miette error displayTesting
Before vs After
Before:
After:
Key Benefits
The implementation focuses on configuration and format errors as these are the most common user-facing errors, while maintaining the existing error handling patterns for other parts of the codebase.
Fixes #44.
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.