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

Current behavior is a C++ assertion failure. This commit also
adds tests. Closes #8187