Module: Imagga::Exceptions

Included in:
BaseCommand, CoreClient, Image, RankOptions
Defined in:
lib/imagga/exceptions.rb

Instance Method Summary collapse

Instance Method Details

#raise_if_request_failed!(result) ⇒ Object



8
9
10
11
12
# File 'lib/imagga/exceptions.rb', line 8

def raise_if_request_failed!(result)
  if result.respond_to?(:keys) && result.keys.include?('error_code')
    raise Imagga::ClientException.new(result['error_code'].to_i), result['error_message'], caller[0..-1]
  end
end

#raise_missing(attribute) ⇒ Object

Raises:

  • (ArgumentError)


4
5
6
# File 'lib/imagga/exceptions.rb', line 4

def raise_missing(attribute)
  raise ArgumentError, "%s is missing" % attribute.to_s
end