Exception: BrainzLab::ConfigurationError

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

Overview

Raised when the SDK is misconfigured or required configuration is missing.

Examples:

Missing API key

raise BrainzLab::ConfigurationError.new(
  "API key is required",
  hint: "Set BRAINZLAB_SECRET_KEY environment variable or configure via BrainzLab.configure",
  code: "missing_api_key"
)

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) ⇒ ConfigurationError

Returns a new instance of ConfigurationError.



124
125
126
127
128
# File 'lib/brainzlab/errors.rb', line 124

def initialize(message = nil, hint: nil, docs_url: nil, code: nil, context: nil)
  docs_url ||= "#{DOCS_BASE_URL}/sdk/ruby/configuration"
  code ||= 'configuration_error'
  super(message, hint: hint, docs_url: docs_url, code: code, context: context)
end