Skip to content

Commit

Permalink
added error when media couldn't be uploaded
Browse files Browse the repository at this point in the history
  • Loading branch information
schochastics committed Nov 6, 2024
1 parent e051f13 commit 2f3deee
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions R/post.R
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,10 @@ upload_media_to_mastodon <- function(media, alt_text, token) {
body = params,
httr::add_headers(Authorization = paste0("Bearer ", token$bearer))
)
if (httr::status_code(r) != 200) {
stop(paste0("Error while uploading: ", media, ". Status Code:", httr::status_code(r)))
}

httr::content(r)$id
}

Expand Down

0 comments on commit 2f3deee

Please sign in to comment.