Module net/errors
net/errors
Network error types.
Types
NetError
enum
NetError
Network-specific error type wrapping lower-level I/O errors.
Variants
| Variant | Fields | Description |
|---|---|---|
ConnectionRefused | The remote host refused the connection. | |
ConnectionReset | The connection was reset by the remote host. | |
ConnectionAborted | The connection was aborted locally. | |
AddrInUse | The address is already in use. | |
AddrNotAvailable | The requested address is not available. | |
TimedOut | The operation timed out. | |
HostUnreachable | The remote host is unreachable. | |
NetworkUnreachable | The network is unreachable. | |
DNSFailed | msg: String | DNS resolution failed. |
IO | err: IOError | A wrapped lower-level I/O error. |
Other | msg: String | An unclassified network error with a message. |
Trait Implementations
impl(NetError, ...)
impl(NetError, ToString(...))
to_string : (self -> {
s := match(self,
.ConnectionRefused => String.from("connection refused"),
.ConnectionReset => String.from("connection reset by peer"),
.ConnectionAborted => String.from("connection aborted"),
.AddrInUse => String.from("address already in use"),
.AddrNotAvailable => String.from("address not available"),
.TimedOut => String.from("operation timed out"),
.HostUnreachable => String.from("host unreachable"),
.NetworkUnreachable => String.from("network unreachable"),
.DNSFailed(msg) => `DNS lookup failed: ${msg}`,
.IO(err) => err.to_string(),
.Other(msg) => msg
);
return s;
})impl(NetError, Error())
impl(NetError, ...)
check : (NetError) fn(result : i32, using(exn : Exception)) -> i32Check a raw syscall result and throw on error.
Positive values are returned as-is; negative values are converted to a NetError and thrown.
Parameters
| Name | Type | Notes |
|---|---|---|
result | i32 |
Returns: i32