Exception: Hanami::Action::UnknownFormatError

Inherits:
Error
  • Object
show all
Defined in:
lib/hanami/action/errors.rb

Overview

Unknown format error

This error is raised when a action sets a format that it isn’t recognized both by ‘Hanami::Action::Configuration` and the list of Rack mime types

See Also:

  • Mime#format=

Since:

  • 2.0.0

Instance Method Summary collapse

Constructor Details

#initialize(format) ⇒ UnknownFormatError

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of UnknownFormatError.

Since:

  • 2.0.0



37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
# File 'lib/hanami/action/errors.rb', line 37

def initialize(format)
  message = <<~MSG
    Cannot find a corresponding MIME type for format `#{format.inspect}'.
  MSG

  unless blank?(format)
    message += <<~MSG

      Configure one via: `config.actions.formats.add(:#{format}, "MIME_TYPE_HERE")' in `config/app.rb' to share between actions of a Hanami app.

      Or make it available only in the current action: `config.formats.add(:#{format}, "MIME_TYPE_HERE")'.
    MSG
  end

  super(message)
end