mirror of
https://github.com/SAP/jenkins-library.git
synced 2025-01-18 05:18:24 +02:00
improve error message when parsing config (#1387)
* improve error message when parsing config * adjust test case Co-authored-by: Florian Wilhelm <florian.wilhelm02@sap.com>
This commit is contained in:
parent
6d5b634278
commit
b0144614e5
@ -41,7 +41,7 @@ func (c *Config) ReadConfig(configuration io.ReadCloser) error {
|
||||
|
||||
err = yaml.Unmarshal(content, &c)
|
||||
if err != nil {
|
||||
return NewParseError(fmt.Sprintf("error unmarshalling %q: %v", content, err))
|
||||
return NewParseError(fmt.Sprintf("format of configuration is invalid %q: %v", content, err))
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
@ -247,7 +247,7 @@ steps:
|
||||
var c Config
|
||||
myConfig := ioutil.NopCloser(strings.NewReader("invalid config"))
|
||||
_, err := c.GetStepConfig(nil, "", myConfig, nil, StepFilters{}, []StepParameters{}, nil, nil, "stage1", "step1", []Alias{})
|
||||
assert.EqualError(t, err, "failed to parse custom pipeline configuration: error unmarshalling \"invalid config\": error unmarshaling JSON: json: cannot unmarshal string into Go value of type config.Config", "default error expected")
|
||||
assert.EqualError(t, err, "failed to parse custom pipeline configuration: format of configuration is invalid \"invalid config\": error unmarshaling JSON: json: cannot unmarshal string into Go value of type config.Config", "default error expected")
|
||||
})
|
||||
|
||||
t.Run("Failure case defaults", func(t *testing.T) {
|
||||
|
Loading…
Reference in New Issue
Block a user