Exception: BrainzLab::AuthenticationError

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

Overview

Raised when authentication fails due to invalid or expired credentials.

Examples:

Invalid API key

raise BrainzLab::AuthenticationError.new(
  "Invalid API key",
  hint: "Check that your API key is correct and has not expired",
  code: "invalid_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) ⇒ AuthenticationError

Returns a new instance of AuthenticationError.



141
142
143
144
145
# File 'lib/brainzlab/errors.rb', line 141

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