dzcode-io / kuliya

Algeria's college hierarchy dataset as packages for different languages and platforms
https://dzcode-io.github.io/kuliya/
MIT License
18 stars 7 forks source link

return a `Result` instead of `Option` #48

Closed omdxp closed 10 months ago

omdxp commented 10 months ago

Is your feature request related to a problem? Please describe. Currently, the get_node_by_path function is returning an Option which doesn't have a clear explanation about the existence or absence of the value.

Describe the solution you'd like It would be nice to have this function to return a Result with custom defined errors. The errors can be defined for all the undesirable behaviors (.e.g. error while parsing data).

Additional context Add any other context or screenshots about the feature request here. I suggest to use thiserror instead of anyhow crate as it is more statically defined with all custom error messages, as for anyhow error it is just a pointer to heap allocated data.

Also it's up to a debate 😅