inet6_prefix: Simplify exception handling

The following exceptions all inherit IPAddr::Error, which inherits
ArgumentError.
  - IPAddr::AddressFamilyError
  - IPAddr::InvalidAddressError
  - IPAddr::InvalidPrefixError

Because we use the same logic for all of these exceptions, we can just
catch the base ArgumentError instead of listing all these separately.

Change-Id: Ie88fce429e1b73a89820a94e8635ed6ad906b07f
This commit is contained in:
Takashi Kajinami 2022-11-24 12:16:48 +09:00
parent e0d9546380
commit 779c96bc49

@ -20,7 +20,7 @@ Puppet::Functions.create_function(:inet6_prefix) do
ip = "inet6:[#{ip_parts.shift}]#{ip_parts.join}"
end
end
rescue IPAddr::AddressFamilyError, IPAddr::Error, IPAddr::InvalidAddressError, IPAddr::InvalidPrefixError, ArgumentError, NoMethodError => e
rescue ArgumentError, NoMethodError => e
# ignore it
end
result << ip