-
Notifications
You must be signed in to change notification settings - Fork 9
Resolve GitHub issue 187 #282
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
base: master
Are you sure you want to change the base?
Conversation
Co-authored-by: kindritskiy.m <[email protected]>
Reviewer's GuideIntroduces a DependencyError type to capture and display a dependency chain when a command fails, enhances the execution context to track command dependencies, wraps execution errors into DependencyError in the dependency runner, updates the main exit handling to respect custom exit codes, and adds comprehensive tests to verify the dependency tree output. Sequence diagram for error wrapping in dependency executionsequenceDiagram
participant Executor
participant Context
participant Command
participant DependencyError
participant ExecuteError
Executor->>Context: executeDepends(ctx)
Context->>Command: Execute(ChildExecutorCtx(ctx, cmd))
Command-->>Context: error (may be ExecuteError)
Context->>Executor: error
Executor->>DependencyError: Wrap error if not DependencyError
DependencyError-->>Executor: DependencyError instance
Executor-->>Context: DependencyError
Class diagram for new DependencyError and updated ContextclassDiagram
class DependencyError {
+string rootCommand
+string failedCommand
+[]string dependencyPath
+error underlyingErr
+int exitCode
+Error() string
+getUnderlyingErrorMessage() string
+ExitCode() int
+Unwrap() error
}
class Context {
+context.Context ctx
+*config.Command command
+*logging.ExecLogger logger
+[]string dependencyPath
}
File-Level Changes
Assessment against linked issues
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
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.
Hey @kindermax - I've reviewed your changes and they look great!
Prompt for AI Agents
Please address the comments from this code review:
## Individual Comments
### Comment 1
<location> `executor/executor.go:72` </location>
<code_context>
+ return builder.String()
+}
+
+func (e *DependencyError) getUnderlyingErrorMessage() string {
+ if e.underlyingErr == nil {
+ return fmt.Sprintf("exit status %d", e.exitCode)
</code_context>
<issue_to_address>
Parsing error messages by string content is brittle.
Checking for 'exit status' and splitting by ': ' assumes a fixed error format, which may change. Use a more reliable extraction method or document the expected format.
</issue_to_address>Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
| return builder.String() | ||
| } | ||
|
|
||
| func (e *DependencyError) getUnderlyingErrorMessage() string { |
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.
issue: Parsing error messages by string content is brittle.
Checking for 'exit status' and splitting by ': ' assumes a fixed error format, which may change. Use a more reliable extraction method or document the expected format.
Display a dependency tree in error messages when a command fails within a dependency chain (fixes #187).
This improves debuggability by clearly showing which specific command in the chain failed, rather than just a generic "failed to run command" message for the dependent command.
Open Background Agent:
Web · Cursor
Learn more about Background Agents
Summary by Sourcery
Show dependency chains in error messages when a dependent command fails by introducing a new DependencyError type, tracking command dependency paths, and adjusting execution and exit code handling accordingly.
New Features:
Enhancements:
Tests: