std/network/error
std/network/src/error.trb
NetworkError: what every operation of std/network fails with, one wrapper type, so a new kind of failure is never
a breaking change (see "Algebraic Data Types and Pattern Matching" in CONCEPT.md).
type NetworkError
type NetworkError with Show, Error
What went wrong on the network. The kind is a question (isConnectionRefused(), isTimedOut(), ...), and show()
is the operating system's own words, so a log line says what the system said.
fn isConnectionRefused
fn isConnectionRefused(): Bool
The peer refused the connection: nothing listens on that port.
fn isConnectionReset
fn isConnectionReset(): Bool
The peer reset the connection, or it broke while it was in use.
fn isTimedOut
fn isTimedOut(): Bool
The system gave up waiting (a connection attempt the peer never answered).
fn isAddressInUse
fn isAddressInUse(): Bool
The address a listener asked for is taken by another socket.
fn isHostNotFound
fn isHostNotFound(): Bool
The name did not resolve to any address.
fn isUnreachable
fn isUnreachable(): Bool
The network or the host cannot be reached from here.
fn isClosed
fn isClosed(): Bool
The socket was closed before or while the operation ran.
fn isTlsFailure
fn isTlsFailure(): Bool
TLS failed: the peer spoke no TLS, agreed on nothing, or broke the protocol (std/tls).
fn isCertificateRejected
fn isCertificateRejected(): Bool
The peer's certificate was not trusted for the name it was asked for (std/tls).
fn isNameServerFailure
fn isNameServerFailure(): Bool
A name server answered with a failure (SERVFAIL, REFUSED), with no DNS at all, or none is configured.
fn isRetryable
fn isRetryable(): Bool
Worth trying again unchanged: a refused, reset or timed-out connection, or a network that cannot be reached.
fn show
fn show(): String
What the operating system said, or what the operation found.
fn of
static fn of(failure: Int): NetworkError
A failure a native of the runtime answered: its kind packed into the number, its words from the runtime.
fn withWords
static fn withWords(failure: Int, words: String): NetworkError
A failure a native of std/tls answered, with the words that package's runtime found for it: the kind is read out
of the number as NetworkError.of reads it, and the words are not the IO core's, which knows nothing of TLS.
fn closed
static fn closed(): NetworkError
The socket is closed: an operation on a stream or a listener after its close().
fn timedOut
static fn timedOut(message: String): NetworkError
Nobody answered in time: message says who and how long.
fn nameServerFailed
static fn nameServerFailed(message: String): NetworkError
A name server failed a lookup, as message says.
fn hostNotFound
static fn hostNotFound(host: String): NetworkError
host resolved to no address.
fn invalid
static fn invalid(message: String): NetworkError
An argument the operation cannot take: an address of the wrong IP version, a socket that is not connected.
fn invalidAddress
static fn invalidAddress(cause: AddressError): NetworkError
An address that is none, where one was read from text.
fn about
fn about(subject: String): NetworkError
The same failure, with what the operation was about in front: "connecting to 127.0.0.1:9: ...".
extend NetworkError with From<AddressError>
extend NetworkError with From<AddressError>
An address read from text that is none.
fn from
static fn from(value: AddressError): NetworkError
extend NetworkError with From<DnsError>
extend NetworkError with From<DnsError>
A name that is no domain name, where a lookup was asked for one: lookup(DomainName.tryFrom(text)?, ...).
fn from
static fn from(value: DnsError): NetworkError