Exception: Soka::Rails::MissingApiKeyError

Inherits:
ConfigurationError show all
Defined in:
lib/soka/rails/errors.rb

Overview

Specific error classes Raised when API key is missing for the configured provider

Instance Method Summary collapse

Constructor Details

#initialize(provider = nil) ⇒ MissingApiKeyError

Returns a new instance of MissingApiKeyError.



27
28
29
30
31
32
33
34
35
# File 'lib/soka/rails/errors.rb', line 27

def initialize(provider = nil)
  message = if provider
              "Missing API key for provider: #{provider}. " \
                "Please set SOKA_API_KEY or SOKA_#{provider.to_s.upcase}_API_KEY environment variable."
            else
              'Missing API key. Please set SOKA_API_KEY environment variable.'
            end
  super(message)
end