-
Notifications
You must be signed in to change notification settings - Fork 45
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Raise ValueError for empty string namespace prefix #142
Comments
Hello, could you provide an example where it failed? I'm not sure what issue you are having at the moment. |
I'm filling a ProvDocument programmatically by reading the metadata. In the event that someone hasn't filled a field, I am trying to define a namespace with an empty string. When this happens, I don't get an exception thrown until I come to serialise the document. Now of course, I have encountered the problem and built a check into my code, but in a more complex pipeline, the error I received and the point in the code that it was thrown did not make it clear where the problem was. An earlier check on the call to add_namespace() would have told me which namespace was invalid.
In a script with multiple namespaces defined, the above traceback does not indicate where the problem occurred, as the error isn't caught until much later. |
Thanks for the information, Nathan. I'll pop this test in the code next time. |
Hiya, I'm getting an invalid namespace prefix error. While I understand the error entirely, it is being raised at the point of serialisation, and in the circumstance that I have defined several namespaces programmatically, I do not know which one isn't being filled properly.
Would it be better/possible to check for namespace validity within the add_namespace() method, to follow the principle of failing fast/early?
The text was updated successfully, but these errors were encountered: