]> cat aescling's git repositories - mastodon.git/commitdiff
Raise an error if salmon request response is unsatisfactory (#3960)
authorThibG <thib@sitedethib.com>
Mon, 26 Jun 2017 17:39:58 +0000 (19:39 +0200)
committerEugen Rochko <eugen@zeonfederated.com>
Mon, 26 Jun 2017 17:39:58 +0000 (19:39 +0200)
app/services/send_interaction_service.rb

index 504f41c7278ef7e9fb79bbf784c5e998babfd488..34c8f9e34ab784b5aa50af39bdfe27a25e7e3177 100644 (file)
@@ -13,7 +13,8 @@ class SendInteractionService < BaseService
     return if block_notification?
 
     envelope = salmon.pack(@xml, @source_account.keypair)
-    salmon.post(@target_account.salmon_url, envelope)
+    delivery = salmon.post(@target_account.salmon_url, envelope)
+    raise "Delivery failed for #{target_account.salmon_url}: HTTP #{delivery.code}" unless delivery.code > 199 && delivery.code < 300
   end
 
   private