Conditions | 3 |
Total Lines | 15 |
Lines | 15 |
Ratio | 100 % |
Changes | 0 |
1 | # frozen_string_literal: true |
||
26 | def normalize(entity, type, context = nil) |
||
27 | ctx = context || Context.new |
||
28 | @processor.normalize(entity, type, ctx) do |e, t, c| |
||
29 | @fallback.normalize(e, t, c) |
||
30 | end |
||
31 | rescue StandardError => e |
||
32 | raise_if_internal(e) |
||
33 | message = "Error while normalizing #{entity} (type: #{type}) " \ |
||
34 | "using #{@processor}" |
||
35 | if e.is_a?(ArgumentError) |
||
36 | message += "Does #{@processor}#normalize have signature " \ |
||
37 | '(entity, type, context = nil)?' |
||
38 | end |
||
39 | mapping_error(message, parent: e, context: ctx) |
||
40 | end |
||
41 | end |
||
47 |