summaryrefslogtreecommitdiffhomepage
path: root/lib/dispatch/adapter/interface/errors.rb
diff options
context:
space:
mode:
authorAdam Malczewski <[email protected]>2026-04-28 14:11:16 +0900
committerAdam Malczewski <[email protected]>2026-04-28 14:11:16 +0900
commit07277435c0688ad9f5fa682633b86b99ef5bb854 (patch)
tree3e650e97bcbd229f942330542a333dcad1844542 /lib/dispatch/adapter/interface/errors.rb
downloaddispatch-adapter-interface-07277435c0688ad9f5fa682633b86b99ef5bb854.tar.gz
dispatch-adapter-interface-07277435c0688ad9f5fa682633b86b99ef5bb854.zip
update
Diffstat (limited to 'lib/dispatch/adapter/interface/errors.rb')
-rw-r--r--lib/dispatch/adapter/interface/errors.rb30
1 files changed, 30 insertions, 0 deletions
diff --git a/lib/dispatch/adapter/interface/errors.rb b/lib/dispatch/adapter/interface/errors.rb
new file mode 100644
index 0000000..86f9c14
--- /dev/null
+++ b/lib/dispatch/adapter/interface/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