waltzofpearls / dateparser

Parse dates in commonly used string formats with Rust.
MIT License
41 stars 8 forks source link

Convert `anyhow::Result`s in parsing functions to custom error type. #32

Open cogsandsquigs opened 1 year ago

cogsandsquigs commented 1 year ago

I like this library, but one downside is that it returns an anyhow::Result instead of a custom error type. Generally, it's better for libraries to implement these custom error types as it gives more information to the user about what went wrong, as anyhow::Result can be very vague at times. Consider possibly using thiserror or snafu? That way I can actually see (and report!) what went wrong instead of dealing with an opaque type returned by anyhow.

waltzofpearls commented 1 year ago

Hey @cogsandsquigs, thanks for the suggestion. That's a great idea. I will take a look at thiserror and snafu, and make improvements on error handling.