Skip to content

Commit 1863e4d

Browse files
committed
fix(parser): return error for unknown parser type
Previously, if the parser type did not match any valid types, Parse would silently do nothing and return nil as if it succeeded. This made it easy to miss typos or invalid parser types. Now, an unknown parser type will return an error, making it easier to catch mistakes.
1 parent 3b968bb commit 1863e4d

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

parser/parser.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,10 @@ func (f *ConfigurationFile) Parse(file ufs.File) error {
215215
err = f.parseIniFile(file)
216216
case Xml:
217217
err = f.parseXmlFile(file)
218+
default:
219+
return errors.Errorf("parser: unknown parser type %q", f.Parser)
218220
}
221+
219222
return err
220223
}
221224

0 commit comments

Comments
 (0)