Use try() more.
Quick fix on errors that crash the script and prevent later issues from being posted.
This commit is contained in:
@ -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.
|
||||||
|
Reference in New Issue
Block a user