Skip to content

Ensure that any error path out of doPodcastDownload sets status#672

Merged
sentriz merged 1 commit into
sentriz:masterfrom
khers:podcast-status
Mar 11, 2026
Merged

Ensure that any error path out of doPodcastDownload sets status#672
sentriz merged 1 commit into
sentriz:masterfrom
khers:podcast-status

Conversation

@khers
Copy link
Copy Markdown
Contributor

@khers khers commented Mar 11, 2026

Some error paths out of this function are not setting the podcast status to 'error'. Move the deferred error checking earlier to ensure the status is set.

Comment thread podcast/podcast.go Outdated
Comment on lines +527 to +530
// We set err = fmt.Errorf() instead of just returning it to make sure the defered
// function to set the podcast status to "error" runs on the way out
err = fmt.Errorf("fetch podcast audio: unexpected status %s", resp.Status)
return err
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hey, you should be able to return it just fine. go will assign whats returned to "err" automatically

see https://go.dev/play/p/IttjQGAqQxs

Suggested change
// We set err = fmt.Errorf() instead of just returning it to make sure the defered
// function to set the podcast status to "error" runs on the way out
err = fmt.Errorf("fetch podcast audio: unexpected status %s", resp.Status)
return err
return fmt.Errorf("fetch podcast audio: unexpected status %s", resp.Status)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

I will update the PR shortly.

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks!

Some error paths out of this function are not setting the podcast status
to 'error'. Move the deferred error checking earlier to ensure the
status is set.

Signed-off-by: Eric B Munson <eric@munsonfam.org>
@sentriz sentriz merged commit 192ee10 into sentriz:master Mar 11, 2026
1 check passed
yaemiku pushed a commit to yaemiku/gonic that referenced this pull request Apr 26, 2026
…ts status (sentriz#672)

Some error paths out of this function are not setting the podcast status
to 'error'. Move the deferred error checking earlier to ensure the
status is set.

Signed-off-by: Eric B Munson <eric@munsonfam.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants