#' @keywords internal
handle_errors <- function(api_req) {
json <- content(api_req, as = "text", encoding = "UTF-8") %>%
fromJSON(simplifyDataFrame = TRUE)
if(api_req$status_code != 200) {
stop(paste("Server status ", api_req$status_code,
", last.fm API error #", json$error,
": ", json$message,
sep = ""))
}
return(json)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.