Provide better error message for invalid endpoint urls

Fixes #899 


cc @danielgtaylor @kyleknap