You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Aug 31, 2023. It is now read-only.
This file contains 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
This PR implements the trait Diagnostic to the enum RomeError. This change doesn't change the current logic of how the errors are printed to the console.
List of the changes:
the various errors defined in the multiple crates have been moved inside a generic file called diagnostics.rs, and it seems a generic pattern we are adopting across the code base
insta has been moved into the workspace, so we have one single version across the code base
some errors have been slightly changed, for example, the ConfigurationError, so more and better information can be printed using the Diagnostic trait
the messages inside the message() and description() functions are a copy-paste from the Display trait, and I intend to keep them this way. We can review the messaging once the transition is completed and we print these diagnostics in the CLI
various errors have now snapshot tests, to show people how they will look like once the transition is finished (not in this PR)
These changes are safe and can be merged whenever.
Test Plan
I created new snapshots to show the look and file of the changes.
The current tests of the CLI should stay the same.
The reason will be displayed to describe this comment to others. Learn more.
For diagnostics that contain an error, it might be more readable to print a message here (like "the formatter encountered an error while formatting the file" as we do in the Display implementation) and return the inner error as the source for this diagnostic (but this may not be possible currently since the Error type does not implement AsRef<dyn Diagnostic>)
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.
Summary
This PR implements the trait
Diagnostic
to the enumRomeError
. This change doesn't change the current logic of how the errors are printed to the console.List of the changes:
diagnostics.rs
, and it seems a generic pattern we are adopting across the code baseinsta
has been moved into the workspace, so we have one single version across the code baseConfigurationError
, so more and better information can be printed using theDiagnostic
traitmessage()
anddescription()
functions are a copy-paste from theDisplay
trait, and I intend to keep them this way. We can review the messaging once the transition is completed and we print these diagnostics in the CLIThese changes are safe and can be merged whenever.
Test Plan
I created new snapshots to show the look and file of the changes.
The current tests of the CLI should stay the same.