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 RDF/XML parser error #32

Merged
merged 4 commits into from
Jan 22, 2020

Conversation

MattesWhite
Copy link
Contributor

Continue the work for #8 .

Refactors the error-handling in parser::xml.

  • Everything related to error-chain is removed
  • A new thiserror-based error type is introduced
  • WithLocation is supported
  • The big xml.rs is split into smaller modules

Note: The version of quick_xml was updated. In the newer version they removed the dependency on failure and implemented std::error::Error for their error type.

In the newer version of quick-xml the `failure` crate is removed and
`quick_xml::Error` now implements `std::error::Error`.
Replace everything `error-chain` related in the XML-parser.
In addition xml.rs was refactored into smaller mods (the original file
over 1800 lines).
Furthermore, the parser-error variants of `error::Error` where removed.
Introduced `LocatableError` to add locations to an error with custom
sources of location.
Based on that `LocateResult` is introduced. An extension trait for
`Result`s that basically performs `map_err`.
Ok(name) => Err(RdfError::UnexpectedEvent {
expected: format!("<{}>", name),
found: "text".to_owned(),
})
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@althonos I refactored the lines above for the new error-handling in sophia.

I'm not sure if expected and found are switched or if it is correct this way. Could you tell me, please?

Same case l.613

@MattesWhite
Copy link
Contributor Author

What about merging this PR? As @althonos already 'thumb uped' this PR I guess he agrees to this.

@pchampin
Copy link
Owner

Sorry, the thumbs up didn't generate any notification, so I hadn't noticed it :) Good for me.

@pchampin pchampin merged commit fddbcd2 into pchampin:master Jan 22, 2020
@MattesWhite MattesWhite deleted the xml-parser-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