Exception: BrainzLab::ConnectionError

Inherits:
Error
  • Object
show all
Defined in:
lib/brainzlab/errors.rb

Overview

Raised when a connection to BrainzLab services cannot be established.

Examples:

Connection timeout

raise BrainzLab::ConnectionError.new(
  "Connection timed out",
  hint: "Check your network connection and firewall settings",
  code: "connection_timeout"
)

Constant Summary

Constants inherited from Error

Error::DOCS_BASE_URL

Instance Attribute Summary

Attributes inherited from Error

#code, #context, #docs_url, #hint

Instance Method Summary collapse

Methods inherited from Error

#as_json, #detailed_message, #inspect, #to_h, #to_s

Constructor Details

#initialize(message = nil, hint: nil, docs_url: nil, code: nil, context: nil) ⇒ ConnectionError

Returns a new instance of ConnectionError.



158
159
160
161
162
# File 'lib/brainzlab/errors.rb', line 158

def initialize(message = nil, hint: nil, docs_url: nil, code: nil, context: nil)
  docs_url ||= "#{DOCS_BASE_URL}/sdk/ruby/troubleshooting#connection-issues"
  code ||= 'connection_error'
  super(message, hint: hint, docs_url: docs_url, code: code, context: context)
end