Better error messages for failed dns resolution

Closes #10466