Skip to content
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

serd_env_expand and SERD_ERR_BAD_CURIE #17

Closed
blake-regalia opened this issue May 16, 2018 · 4 comments
Closed

serd_env_expand and SERD_ERR_BAD_CURIE #17

blake-regalia opened this issue May 16, 2018 · 4 comments

Comments

@blake-regalia
Copy link

serd_env_expand will return SERD_ERR_NOT_FOUND if the prefix does not exist / was not found, and yet the enum doc for SERD_ERR_BAD_CURIE says: "Invalid CURIE (e.g. prefix does not exist)". Not a huge deal, but a bit redundant/confusing? Just intuitively, after the reading the docs, I would expect serd_env_expandto return the 'bad curie' enum value instead of the 'not found' one.

@drobilla
Copy link
Owner

Not sure I agree. BAD_CURIE curie implies a syntax error and is used when reading, so this is the error you will get if you try to parse a file that contains a bad CURIE.

For using the env API directly, it would be a bit weird for it to return BAD_CURIE if the string itself is a perfectly good curie (and not, say, missing a colon) but the prefix just isn't in the env.

Perhaps "prefix does not exist" should be its own error to distinguish a syntactically invalid CURIE from an undefined prefix in both places?

@blake-regalia
Copy link
Author

Just to be clear, I am saying that the documentation is unclear in this regard. Namely, that BAD_CURE literally says "prefix does not exist" in the docs. Not sure what you mean by "not agree" since I am only pointing out the confusion from a user's perspective.

@drobilla
Copy link
Owner

I meant agree with your expectation that serd_env_expand would return something else. This is a context problem, the errors were written for a reading and writing perspective (it's relatively uncommon to use this part of the API directly in application code).

I guess I could either simply remove the "prefix does not exist" from that comment, or make serd_env_expand return it in the not found case (which would make SERD_ERR_NOT_FOUND unused, but oh well), and stick with SERD_ERR_BAD_ARG if the input isn't a CURIE at all?

@drobilla
Copy link
Owner

a0c483d

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants