Module: AnotherApi::ErrorHandling
- Extended by:
- ActiveSupport::Concern
- Included in:
- BaseController
- Defined in:
- lib/another_api/error_handling.rb
Class Method Summary collapse
-
.mapping_for(exception) ⇒ Object
Find the consumer-declared mapping (if any) whose exception class matches ‘exception`.
Class Method Details
.mapping_for(exception) ⇒ Object
Find the consumer-declared mapping (if any) whose exception class matches ‘exception`. Exception classes are resolved lazily — a mapping for an unloaded class matches nothing rather than raising.
66 67 68 69 70 71 |
# File 'lib/another_api/error_handling.rb', line 66 def self.mapping_for(exception) AnotherApi.configuration.rescue_registry.find do |mapping| klass = mapping[:exception].safe_constantize klass && exception.is_a?(klass) end end |