Check first if there are any extension elements before checking them individually
This commit is contained in:
parent
2a4adec6bd
commit
3929892602
@ -18,11 +18,13 @@ func (p *Person) Check() error {
|
|||||||
return errors.New("name element of person element empty")
|
return errors.New("name element of person element empty")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if p.Extensions != nil {
|
||||||
for i, e := range p.Extensions {
|
for i, e := range p.Extensions {
|
||||||
if err := e.Check(); err != nil {
|
if err := e.Check(); err != nil {
|
||||||
return fmt.Errorf("extension element %v of person %v: %v", i, p.Name, err)
|
return fmt.Errorf("extension element %v of person %v: %v", i, p.Name, err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user