Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement Error::cause() and source() for BacktraceError #113

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

tormol
Copy link

@tormol tormol commented Apr 14, 2024

I didn't notice cause() wasn't coming from the Error trait, until I passed the error to a &dyn Error-taking function and was surprised that cause() was suddenly returning None.

Is there a reason why it's implemented as an inherent method instead of as part of the Error trait?
I don't think a reference to a boxed trait object lets the caller do anything more than they could with a reference to a trait object.

I've ran most of the pre-commit commands, but the --tests part of cargo test and cargo test --no-default-features fails with:

     Running test/main.rs (target/debug/deps/test-e1f5e416b5ec9618)
INFO [test] Running test issue_90_pass_text_between_threads
thread 'main' panicked at test/main.rs:97:10:
called `Result::unwrap()` on an `Err` value: NoAvailablePixelFormat

(On linux with wayland)

@QuantumBadger
Copy link
Owner

Thanks for submitting this. If I remember correctly, those functions in the Error trait were experimental at the time when Speedy2D was released.

In principle this looks fine, it just needs formatting with cargo +nightly fmt.

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.

2 participants