Added support for better DNS-specific error handling

Thanks to Klaus Darilion and John Bond for their efforts on the mailing list.