Skip to content

Conversation

@ritoban23
Copy link
Contributor

Refactor: Centralize Duplicate Error Handling Utility

This PR addresses #283 by extracting repeated CLI error formatting into a reusable utility function.

Changes

  • Added FormatError and PrintFormattedError to pkg/utils/cliutil.go
  • Replaced duplicate error formatting in:
    • pkg/cmd/create/project.go
    • pkg/cmd/save/experiment.go
  • Added a unit test for the new utility

Why?

  • Follows DRY principles
  • Ensures consistent error output across the CLI

@SarthakJain26
Copy link
Collaborator

@ritoban23 thanks for the PR, the helper function looks good, but you have only updated it in 2 instances. Please also reuse this function in all the places wherever applicable. We want to have a consistent error logging at all the places

@ritoban23 ritoban23 force-pushed the refactor/error-handling-utility-function branch from 4fa2779 to 066056d Compare October 24, 2025 11:06
@SarthakJain26
Copy link
Collaborator

@ritoban23 PR looks good, but the fmt checks are failing, please fix them
Screenshot 2025-10-28 at 3 39 35 PM

@SarthakJain26 SarthakJain26 merged commit 7fdbb3f into litmuschaos:master Oct 31, 2025
4 of 5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants