Fix errors caused by Pawoo exceptions

This commit is contained in:
BrokenEagle
2020-01-29 22:24:23 +00:00
parent a1f959bacb
commit 09841c5b55

View File

@@ -109,11 +109,26 @@ class PawooApiClient
def get(url)
if id = Status.is_match?(url)
return Status.new(JSON.parse(access_token.get("/api/v1/statuses/#{id}").body))
begin
data = JSON.parse(access_token.get("/api/v1/statuses/#{id}").body)
rescue
data = {
"account" => {},
"media_attachments" => [],
"tags" => [],
"content" => "",
}
end
return Status.new(data)
end
if id = Account.is_match?(url)
return Account.new(JSON.parse(access_token.get("/api/v1/accounts/#{id}").body))
begin
data = JSON.parse(access_token.get("/api/v1/accounts/#{id}").body)
rescue
data = {}
end
return Account.new(data)
end
end