Module: Grape::ErrorFormatter
- Extended by:
- Util::Registry
- Defined in:
- lib/grape/error_formatter.rb,
lib/grape/error_formatter/txt.rb,
lib/grape/error_formatter/xml.rb,
lib/grape/error_formatter/base.rb,
lib/grape/error_formatter/json.rb,
lib/grape/error_formatter/serializable_hash.rb
Defined Under Namespace
Classes: Base, Json, SerializableHash, Txt, Xml
Class Method Summary collapse
-
.formatter_for(format, error_formatters = nil) ⇒ Object
Answers nil when nothing is registered for the format, the way
Parser.parser_fordoes.
Methods included from Util::Registry
Class Method Details
.formatter_for(format, error_formatters = nil) ⇒ Object
Answers nil when nothing is registered for the format, the way
Parser.parser_for does. What to fall back to then is the API's own
default_error_formatter, which is the caller's state rather than the
registry's: Middleware::Error holds it and applies it.
13 14 15 16 17 |
# File 'lib/grape/error_formatter.rb', line 13 def formatter_for(format, error_formatters = nil) return error_formatters[format] if error_formatters&.key?(format) registry[format] end |