config: add some validations (#3610)

This commit is contained in:
fatedier
2023-09-13 18:59:51 +08:00
committed by GitHub
parent 7cd02f5bd8
commit 74255f711e
9 changed files with 144 additions and 20 deletions

View File

@@ -99,7 +99,7 @@ func (c *TypedVisitorConfig) UnmarshalJSON(b []byte) error {
c.Type = typeStruct.Type
configurer := NewVisitorConfigurerByType(typeStruct.Type)
if configurer == nil {
return fmt.Errorf("unknown visitor type: %s" + typeStruct.Type)
return fmt.Errorf("unknown visitor type: %s", typeStruct.Type)
}
if err := json.Unmarshal(b, configurer); err != nil {
return err