Are we sure we want to raise an error here instead of failing peacefully with a null URL like in the other language bindings? (I'm not actually sure myself, but there could be something to be said about consistency.)