• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

kaidokert / winc-rs / 16584813860

29 Jul 2025 02:09AM UTC coverage: 85.37% (-0.05%) from 85.421%
16584813860

Pull #102

github

web-flow
Merge 43ba4473a into ae86b85c2
Pull Request #102: Refactor parse_ip_octets to return Result

0 of 3 new or added lines in 1 file covered. (0.0%)

4324 of 5065 relevant lines covered (85.37%)

37781.82 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/winc-rs/src/stack/stack_error.rs
1
use crate::manager::WifiConnError;
2

3
#[cfg(feature = "experimental-ota")]
4
use crate::manager::OtaUpdateError;
5
use crate::manager::SocketError;
6

7
use embedded_nal::nb;
8

9
/// Stack errors
10
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
11
#[derive(Debug, PartialEq)]
12
pub enum StackError {
13
    WouldBlock,
14
    GeneralTimeout,
15
    /// TCP connection timed out
16
    ConnectTimeout,
17
    RecvTimeout,
18
    SendTimeout,
19
    OutOfSockets,
20
    SocketAlreadyInUse,
21
    CloseFailed,
22
    Unexpected,
23
    DispatchError(crate::errors::CommError),
24
    ConnectSendFailed(crate::errors::CommError),
25
    ReceiveFailed(crate::errors::CommError),
26
    SendSendFailed(crate::errors::CommError),
27
    SendCloseFailed(crate::errors::CommError),
28
    BindFailed(crate::errors::CommError),
29
    WincWifiFail(crate::errors::CommError),
30
    OpFailed(SocketError),
31
    /// DNS lookup timed out
32
    DnsTimeout,
33
    /// Unexpected DNS error
34
    DnsFailed,
35
    /// Operation was attempted in wrong state
36
    InvalidState,
37
    AlreadyConnected,
38
    /// Acess point join failed
39
    ApJoinFailed(WifiConnError),
40
    /// Scan operation failed
41
    ApScanFailed(WifiConnError),
42
    // Continue
43
    ContinueOperation,
44
    /// Not found
45
    SocketNotFound,
46
    /// Parameters are not valid.
47
    InvalidParameters,
48
    #[cfg(feature = "experimental-ota")]
49
    /// Ota Error
50
    OtaFail(OtaUpdateError),
51
}
52

53
impl From<core::convert::Infallible> for StackError {
54
    fn from(_: core::convert::Infallible) -> Self {
×
55
        unreachable!()
×
56
    }
57
}
58

59
impl From<SocketError> for StackError {
60
    fn from(inner: SocketError) -> Self {
×
61
        Self::OpFailed(inner)
×
62
    }
×
63
}
64

65
impl From<crate::errors::CommError> for StackError {
66
    fn from(inner: crate::errors::CommError) -> Self {
×
67
        Self::WincWifiFail(inner)
×
68
    }
×
69
}
70

71
impl From<core::net::AddrParseError> for StackError {
NEW
72
    fn from(_: core::net::AddrParseError) -> Self {
×
NEW
73
        Self::InvalidParameters
×
NEW
74
    }
×
75
}
76

77
impl embedded_nal::TcpError for StackError {
78
    fn kind(&self) -> embedded_nal::TcpErrorKind {
×
79
        embedded_nal::TcpErrorKind::Other
×
80
    }
×
81
}
82

83
impl From<nb::Error<StackError>> for StackError {
84
    fn from(inner: nb::Error<StackError>) -> Self {
×
85
        match inner {
×
86
            nb::Error::WouldBlock => StackError::WouldBlock,
×
87
            nb::Error::Other(e) => e,
×
88
        }
89
    }
×
90
}
91

92
impl core::fmt::Display for StackError {
93
    fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
×
94
        match self {
×
95
            Self::WouldBlock => write!(f, "Operation would block"),
×
96
            Self::GeneralTimeout => write!(f, "General timeout"),
×
97
            Self::ConnectTimeout => write!(f, "TCP connection timed out"),
×
98
            Self::RecvTimeout => write!(f, "Receive timeout"),
×
99
            Self::SendTimeout => write!(f, "Send timeout"),
×
100
            Self::OutOfSockets => write!(f, "Out of sockets"),
×
101
            Self::SocketAlreadyInUse => write!(f, "Socket already in use"),
×
102
            Self::CloseFailed => write!(f, "Close failed"),
×
103
            Self::Unexpected => write!(f, "Unexpected error"),
×
104
            Self::DispatchError(err) => write!(f, "Dispatch error: {}", err),
×
105
            Self::ConnectSendFailed(err) => write!(f, "Connect send failed: {}", err),
×
106
            Self::ReceiveFailed(err) => write!(f, "Receive failed: {}", err),
×
107
            Self::SendSendFailed(err) => write!(f, "Send send failed: {}", err),
×
108
            Self::SendCloseFailed(err) => write!(f, "Send close failed: {}", err),
×
109
            Self::BindFailed(err) => write!(f, "Bind failed: {}", err),
×
110
            Self::WincWifiFail(err) => write!(f, "WincWifi fail: {}", err),
×
111
            Self::OpFailed(err) => write!(f, "Operation failed: {}", err),
×
112
            Self::DnsTimeout => write!(f, "DNS lookup timed out"),
×
113
            Self::DnsFailed => write!(f, "DNS lookup failed"),
×
114
            Self::InvalidState => write!(f, "Invalid state"),
×
115
            Self::AlreadyConnected => write!(f, "Already connected"),
×
116
            Self::ApJoinFailed(err) => write!(f, "Access point join failed: {}", err),
×
117
            Self::ApScanFailed(err) => write!(f, "Access point scan failed: {}", err),
×
118
            Self::ContinueOperation => write!(f, "Continue operation"),
×
119
            Self::SocketNotFound => write!(f, "Socket not found"),
×
120
            Self::InvalidParameters => write!(f, "Invalid parameters"),
×
121
            #[cfg(feature = "experimental-ota")]
122
            Self::OtaFail(err) => write!(f, "Ota failure: {:?}", err),
123
        }
124
    }
×
125
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc