-
Notifications
You must be signed in to change notification settings - Fork 61
Closed as not planned
Closed as not planned
Copy link
Labels
Description
Objective
Improve visualization of error chains and nested causes by using lipgloss/tree for hierarchical error rendering.
Context
From discussion #12479 - Go Fan review of charmbracelet/lipgloss usage.
The codebase already uses lipgloss/tree for general hierarchies. Applying this to error reporting would provide clearer visualization of error chains, validation errors with nested causes, and complex error contexts.
Approach
- Identify error rendering functions that would benefit from tree structure
- Create helper function for converting error chains to tree structure
- Implement tree-based rendering for validation errors with nested causes
- Test with complex error scenarios (multiple nested errors)
- Ensure backward compatibility with existing error output
Files to Modify
pkg/console/console.go- Add tree-based error rendering functions- Possibly
pkg/console/errors.goif error-specific file exists - Update error formatting functions to use tree structure
- Add tests for nested error rendering
Example
// Show error chain as a tree
errorTree := tree.Root("ValidationError").
Child("SchemaError: Invalid field 'name'").
Child(tree.Root("TypeError").
Child("Expected: string").
Child("Received: number"))
fmt.Fprintln(os.Stderr, errorTree.String())Acceptance Criteria
- Error chains visualized as tree structures
- Nested errors clearly show parent-child relationships
- Tree rendering respects TTY detection (styled vs plain)
- Works with existing error types and wrapping
- No breaking changes to existing error output format
- Tests cover simple and complex error scenarios
AI generated by Plan Command for discussion #12479
Reactions are currently unavailable