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.



38
39
40
41
# File 'lib/alchemy/errors.rb', line 38

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

Instance Method Details

#messageObject



43
44
45
46
# File 'lib/alchemy/errors.rb', line 43

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