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

Refactor error handling in mods graph and dataset #31

Merged
merged 3 commits into from
Jan 9, 2020

Conversation

MattesWhite
Copy link
Contributor

Continuation of #8 .

Removes unnecessary error variants from sophia::error::Error and adds a new error for the Graph to Dataset wrapper.

Future work

At investigating GraphAsDataset<G, H> I recognized that the second parameter H is used nowhere actually. I could remove this within this PR if you like or did I missed something?

@pchampin It seems to me that the mods parser and serializer are currently adapted to the rio crates. Is this work finished and I can continue refactoring the error handling or should I wait?

The unused error variants `GraphError` and `GraphMutationError` of sophia::error::Error
where removed.
The variant `UnsupportedGraphName` is moved to the new error for
`GraphAsDataset`. The new error provides the moved variant and
wrapps underlying (mutation) errors.
@pchampin
Copy link
Owner

pchampin commented Jan 9, 2020

At investigating GraphAsDataset<G, H> I recognized that the second parameter H is used nowhere

Actually, it is used. GraphAsDataset does not wrap a G(raph) but a Borrow (which is the trait bound on H). So you can decide to wrap either an owned graph or a simple reference to a graph.

It seems to me that the mods parser and serializer are currently adapted to the rio crates.

Not sure what makes you think that... I tried to keep rio-specific code in rio_common.rs and all the parsers that are now based on rio (nt, nq, turtle, trig, ntrig), but parser.rs and serializer.rs are meant to be agnostic. If they are not, this is a bug.

Is this work finished and I can continue refactoring the error handling or should I wait?

I won't be able to work on it in the next week or two, so you are free to go. That being said, may be it would make sense to wait until theses modules are refactored to expose proper traits (as you suggested in #25)...

@pchampin
Copy link
Owner

pchampin commented Jan 9, 2020

Apart from all that, I like what's in this PR. Do you want me to merge it now, or do you plan to include the symetrical work in dataset before? (I'm asking because the title of this PR is hinting at it, not to force you into more work... 😅)

@MattesWhite
Copy link
Contributor Author

Actually the work for dataset is done. Every existing implemtation of Dataset uses Infallible as error (except GraphAsDataset 😉) so far. Therefore, there is nothing to be done.

@pchampin
Copy link
Owner

pchampin commented Jan 9, 2020

Ok cool, merging at once.

After all, I am working now on the parser module, so you might want to wait a little bit before touching it...

@pchampin pchampin merged commit 592eb87 into pchampin:master Jan 9, 2020
@MattesWhite MattesWhite deleted the graph-error branch January 22, 2020 13:08
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

Successfully merging this pull request may close these issues.

2 participants