Implement miette library for enhanced CLI error reporting#45
Draft
Implement miette library for enhanced CLI error reporting#45
Conversation
Co-authored-by: felix-andreas-copilot <216954457+felix-andreas-copilot@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Use miette library
Implement miette library for enhanced CLI error reporting
Jul 15, 2025
Collaborator
|
@copilot please use miette in |
Co-authored-by: felix-andreas-copilot <216954457+felix-andreas-copilot@users.noreply.github.com>
Contributor
Author
I've successfully replaced the custom formatting logic in
The check command now provides much better error display with proper source code context, highlighting, and consistent formatting. All tests are passing. Commit: c9e9f9c |
b04cd93 to
adeb2a3
Compare
4b7acf8 to
f74a5a2
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.