Skip to content
This repository was archived by the owner on Oct 23, 2022. It is now read-only.

Commit 1807d13

Browse files
committed
add(subscription): SubscriptionErr::into_inner
this allows not leaking the SubscriptionErr type anywhere more, but it is sort of kicking the can on the way as we are starting to desperately need proper error types instead of the stringified one.
1 parent 9908ae9 commit 1807d13

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

src/subscription.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -219,6 +219,16 @@ impl<E: Debug + PartialEq> fmt::Display for SubscriptionErr<E> {
219219

220220
impl<E: Debug + PartialEq> std::error::Error for SubscriptionErr<E> {}
221221

222+
impl<E: Debug + PartialEq> SubscriptionErr<E> {
223+
pub fn into_inner(self) -> Option<E> {
224+
use SubscriptionErr::*;
225+
match self {
226+
Cancelled => None,
227+
Failed(e) => Some(e),
228+
}
229+
}
230+
}
231+
222232
/// Represents a request for a resource at different stages of its lifetime.
223233
pub enum Subscription<T, E> {
224234
/// A finished `Subscription` containing the desired `TRes` value.

0 commit comments

Comments
 (0)