Skip to content

Commit

Permalink
Geometries
Browse files Browse the repository at this point in the history
  • Loading branch information
irees committed Jan 10, 2024
1 parent c0a6255 commit 09a31a3
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions copier/result.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@ type updateContext interface {
Update(*causes.Context)
}

type hasGeometries interface {
Geometries() []tt.Geometry
}

// ErrorGroup helps group errors together with a maximum limit on the number stored.
type ErrorGroup struct {
Filename string
Expand Down Expand Up @@ -64,9 +68,13 @@ func (e ValidationError) Error() string {
// Add an error to the error group.
func (e *ErrorGroup) Add(err error) {
if e.Count < e.Limit || e.Limit == 0 {
e.Errors = append(e.Errors, ValidationError{
ee := ValidationError{
Message: err.Error(),
})
}
if v, ok := err.(hasGeometries); ok {
ee.Geometries = v.Geometries()
}
e.Errors = append(e.Errors, ee)
}
e.Count++
}
Expand Down

0 comments on commit 09a31a3

Please sign in to comment.