Raise IPAddr::InvalidAddressError only if existent

`IPAddr::InvalidAddressError` is not defined in Ruby 1.9.3.

As JRuby 1.7.13 runs in 1.9 mode it fails to catch non-existent
`IPAddr::InvalidAddressError`.

It seems that MRI 1.9.3 evaluates the list of caught exceptions lazily
(`rescue ArgumentError, IPAddr::InvalidAddressError`) so tests pass
even `IPAddr::InvalidAddressError` is not defined because catching
`ArgumentError` is enough to move on.

Note: Rails 5.0 will drop support for 1.9.3 so this code has to be cleaned up
then.