pub enum ApplyError {
ValidationFailed(String),
ListenPortInUse {
attempted: u16,
existing: u16,
},
DhtRestartFailed(String),
LsdRestartFailed(String),
NatRefreshFailed(String),
ConcurrentReconfig,
Io(String),
}Expand description
Errors that can be returned by the transactional apply_settings path.
Covers validation failure, listener bind failure, sub-actor restart
failures, NAT refresh failure, and concurrent reconfig collision.
Each variant is mapped onto an HTTP status by the qBt v2 setPreferences
handler — see ApplyError::http_status.
Variants§
ValidationFailed(String)
Settings::validate() rejected the new settings.
ListenPortInUse
The new listen_port is already in use (typically EADDRINUSE).
attempted is the port we tried to bind; existing is the port
the session is still listening on (rolled back).
Fields
DhtRestartFailed(String)
DHT enable/disable failed.
LsdRestartFailed(String)
LSD enable/disable failed.
NatRefreshFailed(String)
NAT mapping refresh failed.
NOT FATAL when wrapped — see ApplyError::is_fatal. Logged
as a warning; the session continues with the new listen_port but
without router-side mapping.
ConcurrentReconfig
A second setPreferences (or other reconfig) raced this one and
won the in-flight guard. Caller should retry; the previous call’s
effect is observable via a follow-up getSettings query.
Mapped to HTTP 409 Conflict by the qBt v2 setPreferences handler.
Io(String)
A subsystem operation produced a generic I/O error.
Implementations§
Source§impl ApplyError
impl ApplyError
Sourcepub fn http_status(&self) -> u16
pub fn http_status(&self) -> u16
Map this error onto the HTTP status the qBt v2 setPreferences handler should return.
ValidationFailed→ 400 Bad Request.ListenPortInUse→ 409 Conflict (port collision is recoverable).ConcurrentReconfig→ 409 Conflict (another caller raced).DhtRestartFailed/LsdRestartFailed→ 500 Internal.NatRefreshFailed→ 200 OK (non-fatal — caller proceeds; only the warning header tells them mapping refresh missed).Io→ 500 Internal.
Trait Implementations§
Source§impl Debug for ApplyError
impl Debug for ApplyError
Source§impl Display for ApplyError
impl Display for ApplyError
Source§impl Error for ApplyError
impl Error for ApplyError
1.30.0 · Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()
Auto Trait Implementations§
impl Freeze for ApplyError
impl RefUnwindSafe for ApplyError
impl Send for ApplyError
impl Sync for ApplyError
impl Unpin for ApplyError
impl UnsafeUnpin for ApplyError
impl UnwindSafe for ApplyError
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
Source§impl<T> ToStringFallible for Twhere
T: Display,
impl<T> ToStringFallible for Twhere
T: Display,
Source§fn try_to_string(&self) -> Result<String, TryReserveError>
fn try_to_string(&self) -> Result<String, TryReserveError>
ToString::to_string, but without panic on OOM.