Skip to content

Commit

Permalink
Modify API to return empty struct instead of error while querrying em…
Browse files Browse the repository at this point in the history
…pty bundle
  • Loading branch information
anik120 committed Oct 15, 2019
1 parent f2364a8 commit b834912
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
5 changes: 5 additions & 0 deletions pkg/server/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,11 @@ func (s *RegistryServer) GetBundle(ctx context.Context, req *api.GetBundleReques
if err != nil {
return nil, err
}
// if the value of the `bundle` field in the OperatorBundle table is NULL, return an
// empty Bundle struct
if bundleString == "" {
return new(api.Bundle), nil
}
entry := &registry.ChannelEntry{
PackageName: req.GetPkgName(),
ChannelName: req.GetChannelName(),
Expand Down
2 changes: 1 addition & 1 deletion pkg/sqlite/query.go
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ func (s *SQLQuerier) GetBundle(ctx context.Context, pkgName, channelName, csvNam
}

if !rows.Next() {
return "", fmt.Errorf("no bundle found for csv %s", csvName)
return "", fmt.Errorf("no entry found for csv %s", csvName)
}
var bundleStringSQL sql.NullString
if err := rows.Scan(&bundleStringSQL); err != nil {
Expand Down

0 comments on commit b834912

Please sign in to comment.