summaryrefslogtreecommitdiffhomepage
path: root/lib/dispatch/adapter/errors.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/dispatch/adapter/errors.rb')
-rw-r--r--lib/dispatch/adapter/errors.rb30
1 files changed, 30 insertions, 0 deletions
diff --git a/lib/dispatch/adapter/errors.rb b/lib/dispatch/adapter/errors.rb
new file mode 100644
index 0000000..86f9c14
--- /dev/null
+++ b/lib/dispatch/adapter/errors.rb
@@ -0,0 +1,30 @@
+# frozen_string_literal: true
+
+module Dispatch
+ module Adapter
+ class Error < StandardError
+ attr_reader :status_code, :provider
+
+ def initialize(message = nil, status_code: nil, provider: nil)
+ @status_code = status_code
+ @provider = provider
+ super(message)
+ end
+ end
+
+ class AuthenticationError < Error; end
+
+ class RateLimitError < Error
+ attr_reader :retry_after
+
+ def initialize(message = nil, status_code: nil, provider: nil, retry_after: nil)
+ @retry_after = retry_after
+ super(message, status_code:, provider:)
+ end
+ end
+
+ class ServerError < Error; end
+ class RequestError < Error; end
+ class ConnectionError < Error; end
+ end
+end