Add the invalid state to an unreachable panic message
This commit is contained in:
parent
86136c7b5c
commit
b03809ebe3
|
@ -36,6 +36,7 @@ use crate::{
|
||||||
|
|
||||||
use super::{ClientRequest, ErrorSlot, PeerError, SharedPeerError};
|
use super::{ClientRequest, ErrorSlot, PeerError, SharedPeerError};
|
||||||
|
|
||||||
|
#[derive(Debug)]
|
||||||
pub(super) enum Handler {
|
pub(super) enum Handler {
|
||||||
/// Indicates that the handler has finished processing the request.
|
/// Indicates that the handler has finished processing the request.
|
||||||
/// An error here is scoped to the request.
|
/// An error here is scoped to the request.
|
||||||
|
@ -303,6 +304,7 @@ impl Handler {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[derive(Debug)]
|
||||||
#[must_use = "AwaitingResponse.tx.send() must be called before drop"]
|
#[must_use = "AwaitingResponse.tx.send() must be called before drop"]
|
||||||
pub(super) enum State {
|
pub(super) enum State {
|
||||||
/// Awaiting a client request or a peer message.
|
/// Awaiting a client request or a peer message.
|
||||||
|
@ -710,9 +712,9 @@ where
|
||||||
Ok((AwaitingRequest, None)) => unreachable!(
|
Ok((AwaitingRequest, None)) => unreachable!(
|
||||||
"successful AwaitingRequest states must send a response on tx, but tx is None",
|
"successful AwaitingRequest states must send a response on tx, but tx is None",
|
||||||
),
|
),
|
||||||
Ok((AwaitingResponse { .. }, Some(tx))) => unreachable!(
|
Ok((new_state @ AwaitingResponse { .. }, Some(tx))) => unreachable!(
|
||||||
"successful AwaitingResponse states must keep tx, but tx is Some: {:?}",
|
"successful AwaitingResponse states must keep tx, but tx is Some: {:?} for: {:?}",
|
||||||
tx
|
tx, new_state,
|
||||||
),
|
),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue