Skip to content

Commit

Permalink
Return newsletter data even if there's an error
Browse files Browse the repository at this point in the history
  • Loading branch information
tulir committed Oct 22, 2023
1 parent bde5a87 commit 0c67ac8
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions newsletter.go
Original file line number Diff line number Diff line change
Expand Up @@ -166,15 +166,14 @@ func (cli *Client) getNewsletterInfo(input map[string]any, fetchViewerMeta bool)
"fetch_viewer_metadata": fetchViewerMeta,
"input": input,
})
if err != nil {
return nil, err
}
var respData respGetNewsletterInfo
err = json.Unmarshal(data, &respData)
if err != nil {
return nil, err
if data != nil {
jsonErr := json.Unmarshal(data, &respData)
if err == nil && jsonErr != nil {
err = jsonErr
}
}
return respData.Newsletter, nil
return respData.Newsletter, err
}

// GetNewsletterInfo gets the info of a newsletter that you're joined to.
Expand Down

0 comments on commit 0c67ac8

Please sign in to comment.