ioquatix/rubydns — pull request #25 by justfalter (2014-01-17 21:21:30+00:00)
Title: Handle arbitrary decoder errors

I ran into a situation where ruby-core's Message.decode would raise ArgumentError, rather than Resolv::DNS::DecodeError. Specifically, this was when I would query the AAAA record for "baicaicn.com", which returns an invalid packet.

I chose to wrap/cast errors raised from Message.decode as Resolv::DNS::DecodeError, as this had the smallest impact on the codebase. I also added tests to demonstrate the issue.
- Ensure that decode_message wraps arbitrary errors as
Resolv::DNS::DecodeError since ruby-core's throws ArgumentError,
sometimes