jmcnamara / rust_xlsxwriter

A Rust library for creating Excel XLSX files.
https://crates.io/crates/rust_xlsxwriter
Apache License 2.0
250 stars 23 forks source link

Is it possible to add a custom XlsxError #72

Closed han1548772930 closed 6 months ago

han1548772930 commented 6 months ago

Feature Request

XlsxError::form_str("custom XlsxError")

jmcnamara commented 6 months ago

Hi,

That is a good suggestion. I'll add that.

It would look something like this:

use rust_xlsxwriter::XlsxError;

fn main() -> Result<(), XlsxError> {
    Err(XlsxError:: CustomError("Some custom error message".to_string()))
}

With output:

Error: CustomError("Some custom error message")

Is that what you are looking for?

han1548772930 commented 6 months ago

Yes this looks great thank you

jmcnamara commented 6 months ago

I've added a XlsxError::CustomError(String) enum to main. It will be in the next release (v0.61.0).

jmcnamara commented 6 months ago

This is now upstream in the v0.61.0 crate.