Skip to content

Commit b4f74c5

Browse files
authored
fix: fix the misleading log when applying invalid config (#119)
Issue #, if available: #118 *Description of changes:* fix the misleading log when applying invalid config *Testing done:* make test-unit make lint - [ X ] I've reviewed the guidance in CONTRIBUTING.md #### License Acceptance By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license. Signed-off-by: Ziwen Ning <[email protected]>
1 parent 9b275bc commit b4f74c5

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

cmd/finch/main_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ func TestXmain(t *testing.T) {
7979
{
8080
name: "failed to load finch config because of invalid YAML",
8181
wantErr: fmt.Errorf("failed to load config: %w",
82-
fmt.Errorf("failed to unmarshal config file, using default values: %w",
82+
fmt.Errorf("failed to unmarshal config file: %w",
8383
&yaml.TypeError{Errors: []string{"line 1: cannot unmarshal !!str `this is...` into config.Finch"}},
8484
),
8585
),

pkg/config/config.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ func Load(fs afero.Fs, cfgPath string, log flog.Logger, systemDeps LoadSystemDep
114114

115115
var cfg Finch
116116
if err := yaml.Unmarshal(b, &cfg); err != nil {
117-
return nil, fmt.Errorf("failed to unmarshal config file, using default values: %w", err)
117+
return nil, fmt.Errorf("failed to unmarshal config file: %w", err)
118118
}
119119

120120
defCfg := applyDefaults(&cfg, systemDeps, mem)

pkg/config/config_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ cpus: 8
9696
},
9797
want: nil,
9898
wantErr: fmt.Errorf(
99-
"failed to unmarshal config file, using default values: %w",
99+
"failed to unmarshal config file: %w",
100100
&yaml.TypeError{Errors: []string{"line 1: cannot unmarshal !!str `this is...` into config.Finch"}},
101101
),
102102
},

0 commit comments

Comments
 (0)