Skip to content

Add error display in Clean cache view #208

@pashkov256

Description

@pashkov256

Key points:

  1. Add error field to CacheModel struct as in views/rules
  2. Display error message after scanning
  3. Clear error on new scan
  4. Use existing errors package
  5. Follow the same pattern as in rules view

Implementation steps:

  1. Add error field to CacheModel:
type CacheModel struct {
    // ... existing fields ...
    Error *errors.Error
}
  1. Update error handling in scan function:
if err := cache.ClearCache(); err != nil {
    model.Error = errors.New(errors.ErrorTypeValidation, err.Error("Not all files were successfully deleted"))
}
  1. Add error display in View():
if model.Error != nil && m.Error.IsVisible() {
    return styles.ErrorStyle.Render(model.Error.Message)
}
  1. Clear error on new scan:
model.Error

Metadata

Metadata

Assignees

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions