Make parts of html API return Result
with new syntect::Error
#424
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Introduce a new error type
syntect::Error
that can represent any errorthat can happen in syntect, and not only
LoadingError
s.In an upcoming PR, a
syntect::parsing::ParsingError
will be introducedfor
highlight_line()
. But to keep the PR small and easy to review, I wait with that.Using https://github.com/Enselic/cargo-public-items one can easily see what changes to the public API this PR do. Excluding pure additions to the API; the changes are the following:
The reason we want to change these is so that when
highlight_line()
starts to return aResult
, an error can continue to propagate upwards through the above functions. The above functions makes use ofhighlight_line()
.I don't think it is worth the hassle to rename the new functions so that we can have a deprecation message. I think it will be pretty obvious for clients what to do when they get compilation errors. They can simply add an
.unwrap()
to essentially get the same behavior as before. This will of course also be mentioned in the CHANGELOG.md in #409This is one step towards a solution for #98