about summary refs log tree commit diff
path: root/lib/exceptions.rb
diff options
context:
space:
mode:
authorClaire <claire.github-309c@sitedethib.com>2021-03-19 13:57:15 +0100
committerClaire <claire.github-309c@sitedethib.com>2021-03-19 13:57:15 +0100
commit3ad6ef72cb3a02135a0f395a8a46323e86c4b334 (patch)
treeff1f1d15a80f5420c52afd4d975b44c0afe1194e /lib/exceptions.rb
parentba22398c38067e05f141a0dddeb20bf68913988a (diff)
parent741d0952b174740e70a09fe6db6862624dfe1e44 (diff)
Merge branch 'main' into glitch-soc/merge-upstream
Diffstat (limited to 'lib/exceptions.rb')
-rw-r--r--lib/exceptions.rb23
1 files changed, 23 insertions, 0 deletions
diff --git a/lib/exceptions.rb b/lib/exceptions.rb
new file mode 100644
index 000000000..7c8e77871
--- /dev/null
+++ b/lib/exceptions.rb
@@ -0,0 +1,23 @@
+# frozen_string_literal: true
+
+module Mastodon
+  class Error < StandardError; end
+  class NotPermittedError < Error; end
+  class ValidationError < Error; end
+  class HostValidationError < ValidationError; end
+  class LengthValidationError < ValidationError; end
+  class DimensionsValidationError < ValidationError; end
+  class StreamValidationError < ValidationError; end
+  class RaceConditionError < Error; end
+  class RateLimitExceededError < Error; end
+
+  class UnexpectedResponseError < Error
+    def initialize(response = nil)
+      if response.respond_to? :uri
+        super("#{response.uri} returned code #{response.code}")
+      else
+        super
+      end
+    end
+  end
+end