Skip to content

Commit

Permalink
Catch nil-deref when creating catalog entries (#157)
Browse files Browse the repository at this point in the history
A customer reported an error dereferencing `result.JSON201.CatalogEntry`

All responses to this customer that morning were 201s, and
`ParseCatalogV2CreateEntryResponse` appears solid

It's near impossible to debug this without identifying the exact
request, so we're adding nil-handling and will look again if it
reappears
  • Loading branch information
louisheath authored Jan 30, 2025
1 parent 489639b commit c73394b
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,4 +57,4 @@ catalog UI, and add a link in the UI from those types to your repository.

We're happy to accept open-source contributions or feedback. Just open a
PR/issue and we'll get back to you. This repo contains details on
[how to get started with local development](./development.md), and [how to publish a new release](./release.md).
[how to get started with local development](./development.md), and [how to publish a new release](./RELEASE.md).
7 changes: 7 additions & 0 deletions reconcile/entries.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,13 @@ func EntriesClientFromClient(cl *client.ClientWithResponses) EntriesClient {
return nil, err
}

if result == nil {
return nil, errors.New("unexpected nil response")
}
if result.JSON201 == nil {
return nil, errors.New("unexpected nil 201 response")
}

return &result.JSON201.CatalogEntry, nil
},
Update: func(ctx context.Context, entry *client.CatalogEntryV2, payload client.UpdateEntryRequestBody) (*client.CatalogEntryV2, error) {
Expand Down

0 comments on commit c73394b

Please sign in to comment.