Skip to content

Commit f682603

Browse files
committed
Add error type for action to set target sequence number
1 parent 3d1eef7 commit f682603

2 files changed

Lines changed: 18 additions & 1 deletion

File tree

crates/hotfix/src/session.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ use crate::session::admin_request::AdminRequest;
3939
use crate::session::ctx::{PreProcessDecision, SessionCtx, TransitionResult, VerificationResult};
4040
use crate::session::error::SessionCreationError;
4141
use crate::session::error::{InternalSendError, InternalSendResultExt, SessionOperationError};
42-
pub use crate::session::error::{SendError, SendOutcome};
42+
pub use crate::session::error::{SendError, SendOutcome, SetNextTargetSeqNumError};
4343
pub use crate::session::info::{SessionInfo, Status};
4444
pub use crate::session::session_handle::SessionHandle;
4545
#[cfg(not(feature = "test-utils"))]

crates/hotfix/src/session/error.rs

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,23 @@ impl<T> InternalSendResultExt<T> for Result<T, InternalSendError> {
128128
}
129129
}
130130

131+
/// Error returned when setting the next expected target sequence number via admin.
132+
#[derive(Debug, Error)]
133+
pub enum SetNextTargetSeqNumError {
134+
/// The session was not in a state where the target sequence number can be
135+
/// safely adjusted. Only permitted while `Disconnected`.
136+
#[error("operation rejected in state {current:?}; only permitted while disconnected")]
137+
InvalidState { current: crate::session::Status },
138+
139+
/// Channel-level failure — the session task is gone or the responder was dropped.
140+
#[error(transparent)]
141+
Send(#[from] SendError),
142+
143+
/// Underlying store write failed.
144+
#[error(transparent)]
145+
Store(#[from] StoreError),
146+
}
147+
131148
#[cfg(test)]
132149
mod tests {
133150
use super::*;

0 commit comments

Comments
 (0)