Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

obscure error when auth fails for image upload #160

Closed
drmowinckels opened this issue Nov 6, 2024 · 3 comments
Closed

obscure error when auth fails for image upload #160

drmowinckels opened this issue Nov 6, 2024 · 3 comments

Comments

@drmowinckels
Copy link

Hi.

After some debugging I am fairly sure that when a media upload fails due to authentication failure, the error message is very obscure because you never try catching if the media is actually successfully uploaded.

The upload_media_to_mastodon function will just return a NULL because its trying to index something in the response that does not exist if the return is not a 200 (httr::content(r)$id)
Therefore the user error looks like so:

Error in media_id_string[[i]] <- upload_media_to_mastodon(media[[i]],  : 
  replacement has length zero

I think its very worth adding a check if the image was actually uploaded before proceeding.

@schochastics
Copy link
Member

Hi @drmowinckels, Thanks for catching this. Can you check PR #161? I think this should catch the issue

@drmowinckels
Copy link
Author

@schochastics
Copy link
Member

Thanks for checking. I will merge the PR and close this

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

No branches or pull requests

2 participants