Use try() more.

Quick fix on errors that crash the script and prevent later issues from being posted.
This commit is contained in:
Matt
2021-04-17 22:58:08 -05:00
parent 8ef3e64282
commit 73685c7b11

View File

@ -154,10 +154,10 @@ if(nrow(new_requests) > 0){
# Get the image # Get the image
download.file(gsub("small","large",request$image_thumbnail), 'temp.jpg', mode="wb") download.file(gsub("small","large",request$image_thumbnail), 'temp.jpg', mode="wb")
# Post # Post
post_media(mastodon_token, post_text, file = "temp.jpg") try(post_media(mastodon_token, post_text, file = "temp.jpg"))
} else { } else {
# Post without image # Post without image
post_status(mastodon_token, post_text) try(post_status(mastodon_token, post_text))
} }
# After tooting, mark what has been posted. # After tooting, mark what has been posted.