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



23
24
25
26
27
28
29
30
31
32
# File 'lib/hanami/action/errors.rb', line 23

def initialize(format)
  msg =
    if format.to_s != "" # rubocop:disable Style/NegatedIfElseCondition
      "Cannot find a corresponding MIME type for format #{format.inspect}. Configure one via `config.formats.add(#{format}: \"MIME_TYPE_HERE\")`." # rubocop:disable Layout/LineLength
    else
      "Cannot find a corresponding MIME type for `nil` format."
    end

  super(msg)
end