Closed wangfu91 closed 5 months ago
hi again:)
should be fine but give me some time pls. I want to prioritise some other changes before this and do not want to publish new version with such a small change. Thanks for your patience!
regards,
Adam
hi,
https://github.com/jabber-tools/cognitive-services-speech-sdk-rs/pull/15 will be ready for merge soon. I would like to ideally merge your PR together with it, so that we don't create two versions. But there is still one pending item (see above impl std::error::Error for Error {}
). Can you provide the answer please?
regards,
Adam
But there is still one pending item (see above
impl std::error::Error for Error {}
). Can you provide the answer please?
Sorry, could you be more specific? I think I already addressed the pending issue.
i was asking this: question about impl std::error::Error for Error {}
: defining trait without actual method implementation is good for what? Or in other words: how it is intended to work exactly?
see above. Just want to understand how is this empty trait implementation meant and what is it supposed to do actually.
Just want to understand how is this empty trait implementation meant and what is it supposed to do actually.
Based on what I read here: Custom errors and implementing the Error trait, the methods in std::error::Error
trait already have default implementations, and the std::fmt::Display
trait is already implemented and will print the user-friendly error message.
However, I'm now not sure whether we should implement the source method of the Error trait ourselves. Given that we have a caused_by
field which seems to signify the underlying cause of the error, it might be beneficial to return this low-level error from the source method. I'm open to further discussion or guidance on this matter.
I think source + caused_by is ok. merging. this one will be published together with PR17. thanks!
hi,
PR17 is taking longer than expected to finish so I published version 1.0.1 (with PR16) in the meantime. Enjoy! :-)
This PR made one small change: Impl
stdError
trait for theerror::Error
struct, so that it can work well with theanyhow::Result<T>
return type. e.g.