Exception: Echonest::Error

Inherits:
Exception
  • Object
show all
Defined in:
lib/echonest-ruby-api/error.rb

Constant Summary collapse

ERRORS =
{ '-1' => 'Unknown Error', 
  '0' => 'Success',
  '1' => 'Invalid/Missing API Key',
  '2' => 'This API key is not allowed to call that method',
  '3' => 'Rate limit exceeded',
  '4' => 'Missing parameter',
  '5' => 'Invalid parameter',
  '6' => 'Missing echoprint-codegen binary on $PATH'
}

Instance Method Summary collapse

Constructor Details

#initialize(error_code) ⇒ Error

Create a new Echonest::Error object



16
17
18
# File 'lib/echonest-ruby-api/error.rb', line 16

def initialize(error_code)
  @error_code = error_code
end

Instance Method Details

#descriptionObject



21
22
23
# File 'lib/echonest-ruby-api/error.rb', line 21

def description
  ERRORS[@error_code.to_s]
end