Always prefer the default tap.
This commit is contained in:
parent
562d5295f4
commit
eb48d6be95
@ -758,19 +758,12 @@ module Formulary
|
|||||||
when 1
|
when 1
|
||||||
loaders.first
|
loaders.first
|
||||||
when 2..Float::INFINITY
|
when 2..Float::INFINITY
|
||||||
default_tap_loaders, other_loaders = *loaders.partition { _1.tap.core_tap? }
|
# Always prefer the default tap, i.e. behave the same as if loading from the API.
|
||||||
default_tap_loader = default_tap_loaders.first if default_tap_loaders.count
|
if (default_tap_loader = loaders.find { _1.tap.core_tap? })
|
||||||
|
return default_tap_loader
|
||||||
|
end
|
||||||
|
|
||||||
# Put default tap last so that the error message always recommends
|
raise TapFormulaAmbiguityError.new(name, loaders.map(&:tap))
|
||||||
# using the fully-qualified name for non-default taps.
|
|
||||||
taps = other_loaders.map(&:tap) + default_tap_loaders.map(&:tap)
|
|
||||||
|
|
||||||
error = TapFormulaAmbiguityError.new(name, taps)
|
|
||||||
|
|
||||||
raise error unless default_tap_loader
|
|
||||||
|
|
||||||
opoo error if warn
|
|
||||||
default_tap_loader
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
Loading…
x
Reference in New Issue
Block a user