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.



60
61
62
63
# File 'lib/alchemy/errors.rb', line 60

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

Instance Method Details

#messageObject



65
66
67
68
# File 'lib/alchemy/errors.rb', line 65

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