about summary refs log tree commit diff
path: root/app/lib/exceptions.rb
diff options
context:
space:
mode:
authorEugen Rochko <eugen@zeonfederated.com>2017-07-20 01:59:07 +0200
committerGitHub <noreply@github.com>2017-07-20 01:59:07 +0200
commit1fcdaafa6fbe6d746a096c33263d76e6819da46d (patch)
treef12319e574997bea52eb6074e35e84addcfa78fa /app/lib/exceptions.rb
parentf24b81e27f1c6290cc6f43a71a32200a08c47d1c (diff)
Fix webfinger retries (#4275)
* Do not raise unretryable exceptions in ResolveRemoteAccountService

* Removed fatal exceptions from ResolveRemoteAccountService

Exceptions that cannot be retried should not be raised. New exception
class for those that can be retried (Mastodon::UnexpectedResponseError)
Diffstat (limited to 'app/lib/exceptions.rb')
-rw-r--r--app/lib/exceptions.rb10
1 files changed, 10 insertions, 0 deletions
diff --git a/app/lib/exceptions.rb b/app/lib/exceptions.rb
index 9bc802c12..34d84a34f 100644
--- a/app/lib/exceptions.rb
+++ b/app/lib/exceptions.rb
@@ -5,4 +5,14 @@ module Mastodon
   class NotPermittedError < Error; end
   class ValidationError < Error; end
   class RaceConditionError < Error; end
+
+  class UnexpectedResponseError < Error
+    def initialize(response = nil)
+      @response = response
+    end
+
+    def to_s
+      "#{@response.uri} returned code #{@response.code}"
+    end
+  end
 end