Skip to content

Implement std::error::Error for DialogResult and wrap hresult#8

Open
MarijnS95 wants to merge 1 commit intoben-wallis:masterfrom
MarijnS95:impl-error
Open

Implement std::error::Error for DialogResult and wrap hresult#8
MarijnS95 wants to merge 1 commit intoben-wallis:masterfrom
MarijnS95:impl-error

Conversation

@MarijnS95
Copy link

Fixes #5
See also native-dialog-rs/native-dialog-rs#76

The current DialogError type makes it easy for downstream consumers to miss the error reason; some accidentally only printed error_method for example. And this makes it easier to propagate the error object upwards without additional re-wrapping.

At the same time std::io::Error can help format hresult messages nicely using from_raw_os_error(). This error can also be returned out of source() to get a nice "backtrace" of what method caused this failure code.

The current `DialogError` type makes it easy for downstream consumers to
miss the error _reason_; some accidentally only printed `error_method`
for example.  And this makes it easier to propagate the error object
upwards without additional re-wrapping.

At the same time `std::io::Error` can help format `hresult` messages
nicely using `from_raw_os_error()`.  This error can also be returned
out of `source()` to get a nice "backtrace" of what method caused this
failure code.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

impl std::error::Error for DialogResult

1 participant