Skip to content

Commit

Permalink
Set Facebook response code if error, and catch imgur 404s.
Browse files Browse the repository at this point in the history
  • Loading branch information
stefansundin committed Aug 22, 2017
1 parent da25f34 commit ad3d679
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions app.rb
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@
exclude_replies: params[:exclude_replies] || "0",
tweet_mode: "extended"
})
status response.code
return response.message if response.code == 401
return "This user id no longer exists. The user was likely deleted or recreated. Try resubscribing." if response.code == 404
raise TwitterError.new(response) if !response.success?
Expand Down Expand Up @@ -988,11 +989,13 @@
if image_id
response = ImgurParty.get("/gallery/image/#{image_id}")
response = ImgurParty.get("/image/#{image_id}") if !response.success?
return "Can't identify #{image_id} as an image or gallery." if response.code == 404
raise ImgurError.new(response) if !response.success?
user_id = response.parsed_response["data"]["account_id"]
username = response.parsed_response["data"]["account_url"]
elsif album_id
response = ImgurParty.get("/album/#{album_id}")
return "Can't identify #{album_id} as an album." if response.code == 404
raise ImgurError.new(response) if !response.success?
user_id = response.parsed_response["data"]["account_id"]
username = response.parsed_response["data"]["account_url"]
Expand Down

0 comments on commit ad3d679

Please sign in to comment.