Exception: Prefab::Errors::InvalidApiKeyError

Inherits:
Prefab::Error
  • Object
show all
Defined in:
lib/prefab/errors/invalid_api_key_error.rb

Instance Method Summary collapse

Constructor Details

#initialize(key) ⇒ InvalidApiKeyError

Returns a new instance of InvalidApiKeyError.



6
7
8
9
10
11
12
13
14
15
16
# File 'lib/prefab/errors/invalid_api_key_error.rb', line 6

def initialize(key)
  if key.nil? || key.empty?
    message = 'No API key. Set PREFAB_API_KEY env var or use PREFAB_DATASOURCES=LOCAL_ONLY'

    super(message)
  else
    message = "Your API key format is invalid. Expecting something like 123-development-yourapikey-SDK. You provided `#{key}`"

    super(message)
  end
end