Skip to content

Conversation

@tisonkun
Copy link
Contributor

This should be included in #2384, but I failed to find it at that time :\

Comment on lines -310 to -313
/// Try to downcast this error into the exact type T, or return `None`
pub fn downcast<T: Error + 'static>(&self) -> Option<&T> {
self.error.downcast_ref()
}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The doc comment should be "Try to downcast this error as a ref to the exact type T, or return None"

But since it can be written as a fluent call f.error().downcast_ref::<T>(), I tend not to add this method to keep the API less.

@Byron
Copy link
Member

Byron commented Jan 18, 2026

Thanks you, this looks great!

Happy to shed this extra method as well.

@Byron Byron merged commit 829393a into GitoxideLabs:main Jan 18, 2026
30 checks passed
@Byron
Copy link
Member

Byron commented Jan 18, 2026

@tisonkun Please note that I think it's best for me to see the conversion through to the end, and by that time I'd expect gix-error::exn to be stable enough to look at migrating back to exn again.

@tisonkun tisonkun deleted the remaining branch January 19, 2026 00:38
@tisonkun
Copy link
Contributor Author

@tisonkun Please note that I think it's best for me to see the conversion through to the end, and by that time I'd expect gix-error::exn to be stable enough to look at migrating back to exn again.

Ack. Try to fill the gap in #2351 (comment).

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