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

Current behavior is C++ assertion failure. Closes #8187