dns: throw if lookup() hostname is not string or null

Current behavior is C++ assertion failure. Closes #8187
@cjihrig Yeah, realize that. :)

Guess it was more to point out they need to mirror each other.