Exception: Alchemy::WrongImageFormatError

Inherits:
StandardError
  • Object
show all
Defined in:
lib/alchemy/errors.rb

Overview

Raised if calling image_file on a Picture object returns nil.

Instance Method Summary collapse

Constructor Details

#initialize(image, requested_format) ⇒ WrongImageFormatError

Returns a new instance of WrongImageFormatError.



49
50
51
52
# File 'lib/alchemy/errors.rb', line 49

def initialize(image, requested_format)
  @image = image
  @requested_format = requested_format
end

Instance Method Details

#messageObject



54
55
56
57
# File 'lib/alchemy/errors.rb', line 54

def message
  allowed_filetypes = Alchemy::Picture.allowed_filetypes.map(&:upcase).to_sentence
  "Requested image format (#{@requested_format.inspect}) for #{@image.inspect} is not one of allowed filetypes (#{allowed_filetypes})."
end