Format dependency failure output as an indented tree#324
Merged
Conversation
Reviewer's GuideRefactors dependency failure reporting so that dependency trees are rendered by DependencyError.TreeMessage() as an indented, jointed "command failed:" block routed through the logger, while preserving a separate final failure status line and updating tests and docs accordingly. Sequence diagram for new dependency failure logging flowsequenceDiagram
actor User
participant CLI
participant Executor
participant Logger
participant Stderr
User->>CLI: run failing command
CLI->>Executor: execute command with dependencies
Executor-->>CLI: error DependencyError
CLI->>Logger: Errorf(%s, depErr.TreeMessage())
Logger->>Stderr: lets: command failed: block with indented tree
CLI->>Logger: Errorf(%s, depErr.FailureMessage())
Logger->>Stderr: lets: exit status N
Class diagram for updated DependencyError and dependency tree printingclassDiagram
class DependencyError {
[]string Chain
error Err
Error() string
Unwrap() error
FailureMessage() string
TreeMessage() string
}
class ExecutorPackage {
+PrintDependencyTree(e DependencyError, w io.Writer) void
}
class ColorPackage
class IoWriter
ExecutorPackage ..> DependencyError : uses
ExecutorPackage ..> IoWriter : writes_to
DependencyError ..> ColorPackage : colors_failure_marker
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
Contributor
There was a problem hiding this comment.
Your free trial has ended. If you'd like to continue receiving code reviews, you can add a payment method here.
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.
Summary
lets:prefix stays formatter-ownedDependencyError.TreeMessage()to render acommand failed:block with two-space indentation and└─jointsTesting
lets fmtgo test ./internal/executor -run "TestDependencyErrorFailureMessage|TestPrintDependencyTree" -vlets test-bats dependency_failure_tree.batsgo test ./...Summary by Sourcery
Format dependency failure output as a structured, indented tree message routed through the logger while preserving the final failure status line.
Enhancements: