Check exception type for DnsException