pipecd
pipecd copied to clipboard
fix(pkg/config): use provider type instead of name in unsupported type error messages
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.
I'd like to work on this.