Skip to content

Commit

Permalink
fix: propagate fetcher errors back to the user
Browse files Browse the repository at this point in the history
  • Loading branch information
reubenmiller committed Jan 22, 2025
1 parent af1c9b7 commit d13fc64
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
8 changes: 6 additions & 2 deletions pkg/c8yfetcher/c8yfetcher.go
Original file line number Diff line number Diff line change
Expand Up @@ -130,8 +130,10 @@ func lookupEntity(fetch EntityFetcher, values []string, getID bool, format strin
Data: resultSet,
})
}
} else {
// Propagate errors back to the caller
return entities, err
}
// TODO: Handle error
} else {
entities = append(entities, entityReference{
ID: applyFormatter(id, format),
Expand All @@ -150,8 +152,10 @@ func lookupEntity(fetch EntityFetcher, values []string, getID bool, format strin
Data: resultSet,
})
}
} else {
// Propagate errors back to the caller
return entities, err
}
// TODO: Handle error
}

return entities, nil
Expand Down
6 changes: 2 additions & 4 deletions pkg/mapbuilder/mapbuilder.go
Original file line number Diff line number Diff line change
Expand Up @@ -1060,10 +1060,8 @@ func (b *MapBuilder) MarshalJSONObject() (body []byte, err error) {
Logger.Debugf("body iterator. path=%s, value=%s", it.Path, value)

if itErr != nil {
if itErr == io.EOF {
err = itErr
return
}
err = itErr
return
} else {
switch extInput := input.(type) {
case []byte:
Expand Down

0 comments on commit d13fc64

Please sign in to comment.