Skip to content

fix(pkg/config): use provider type instead of name in unsupported type error messages #6931

Description

@kunal-yelgate

Description

The error messages returned by PipedPlatformProvider.MarshalJSON() and PipedAnalysisProvider.MarshalJSON() incorrectly display the provider's Name rather than the invalid Type when an unsupported provider type is encountered.

Current Behavior

In pkg/config/piped.go, the following error messages are generated:

default:
    err = fmt.Errorf("unsupported platform provider type: %s", p.Name)
default:
    err = fmt.Errorf("unsupported analysis provider type: %s", p.Name)

As a result, users see the provider name instead of the actual invalid type value.

Example:

platformProviders:
  - name: my-provider
    type: UNKNOWN_TYPE

Current error:

unsupported platform provider type: my-provider

Expected Behavior

The error should report the unsupported type value:

unsupported platform provider type: UNKNOWN_TYPE

Benefits

  • Improves debugging experience.
  • Makes error messages accurate and actionable.
  • Reduces confusion when diagnosing configuration issues.
  • No functional behavior changes; only error message output is corrected.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    kind/bugSomething isn't working as expected

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions