Skip to content

[chore]: Replace panic() calls with proper error handling #7955

@aaryan359

Description

@aaryan359

Requirement

Summary

Several commands in the Jaeger codebase use panic() for error handling. This issue proposes replacing those panic() calls with proper error returns and handling to improve robustness and prevent unexpected runtime crashes.

Files Affected

  • cmd/tracegen/main.go
  • cmd/es-rollover/app/flags.go
  • cmd/es-index-cleaner/app/flags.go
  • cmd/internal/flags/flags.go

Problem

Using panic() for expected error scenarios:

  • Causes abrupt application crashes
  • Makes CLI tools less user-friendly
  • Prevents graceful error reporting and testing

Proposed Solution

  1. Replace panic(err) with proper error returns.
  2. Update callers to handle and propagate errors appropriately.
  3. Improve error messages to be more descriptive and user-friendly.
  4. Add or update tests to cover error paths where applicable.

Impact

  • Improves stability and reliability of Jaeger CLI tools
  • Aligns with Go best practices for error handling
  • No functional or API-breaking changes

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions