Closed jmcnamara closed 1 year ago
I've only just started using this library, and haven't got experience with the C, or Python versions of the library. However, in general I support returning errors for dataloss situations. I think rust programmers generally expect robustness and would rather know the constraints and allow accurate reporting of data issues etc.
I can see the use case for still being able to create a valid file even with some dataloss though.
As inspiration, you could have a look at what chrono has done? They have two versions of a lot of functions one that returns an option and one that just panics (they're actually in the process of phase this out but still...)
https://docs.rs/chrono/latest/chrono/naive/struct.NaiveDate.html#method.from_ymd https://docs.rs/chrono/latest/chrono/naive/struct.NaiveDate.html#method.from_ymd_opt
You could potentially do something similar with something like write_data_lossy
which would not return and error, and have another version of the function write_data
that does return an error?
@jmbrunskill thanks for the feedback and suggestions.
Request for Feedback
Currently the
rust_xlsxwriter
error generation and handling is a bit restrictive. For background the error conditions are listed in the XlsxError docs: https://docs.rs/rust_xlsxwriter/latest/rust_xlsxwriter/enum.XlsxError.htmlThere are 2 levels of error that can affect an Excel file:
save()
methods.I am looking for feedback from people using the library on their experience with the APIs and error handling.