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 14:34:08 +0100
committerGitHub <noreply@github.com>2021-03-19 14:34:08 +0100
commitc7f04961b6dcb1b7e12136deadcf65076c130c40 (patch)
tree20788cbb86d4ae8d38ce539325205e5f0a1ee344 /lib/exceptions.rb
parentba22398c38067e05f141a0dddeb20bf68913988a (diff)
parent3b7b607300d662aa1f25d459ca12aec89ab550e8 (diff)
Merge pull request #1513 from ClearlyClaire/glitch-soc/merge-upstream
Merge upstream changes
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