Module net/errors

net/errors

Network error types.

Types

NetError enum
NetError

Network-specific error type wrapping lower-level I/O errors.

Variants

VariantFieldsDescription
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.

DNSFailedmsg: String

DNS resolution failed.

IOerr: IOError

A wrapped lower-level I/O error.

Othermsg: String

An unclassified network error with a message.

Trait Implementations

impl(NetError, ...)
from_io : (NetError) fn(err : IOError) -> NetError

Convert an IOError into the corresponding NetError variant.

Parameters

NameTypeNotes
errIOError

Returns: 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)) -> i32

Check a raw syscall result and throw on error. Positive values are returned as-is; negative values are converted to a NetError and thrown.

Parameters

NameTypeNotes
resulti32

Returns: i32