Enum

error-code

Error codes.

In theory, every API can return any error code. In practice, API's typically only return the errors documented per API combined with a couple of errors that are always possible:

  • unknown
  • access-denied
  • not-supported
  • out-of-memory
  • concurrency-conflict

See each individual API for what the POSIX equivalents are. They sometimes differ per API.

enum error-code {
  unknown,
  access-denied,
  not-supported,
  invalid-argument,
  out-of-memory,
  timeout,
  concurrency-conflict,
  not-in-progress,
  would-block,
  invalid-state,
  new-socket-limit,
  address-not-bindable,
  address-in-use,
  remote-unreachable,
  connection-refused,
  connection-reset,
  connection-aborted,
  datagram-too-large,
  name-unresolvable,
  temporary-resolver-failure,
  permanent-resolver-failure,
}

Cases

CaseDescription
unknown

Unknown error

access-denied

Access denied.

POSIX equivalent: EACCES, EPERM

not-supported

The operation is not supported.

POSIX equivalent: EOPNOTSUPP

invalid-argument

One of the arguments is invalid.

POSIX equivalent: EINVAL

out-of-memory

Not enough memory to complete the operation.

POSIX equivalent: ENOMEM, ENOBUFS, EAI_MEMORY

timeout

The operation timed out before it could finish completely.

concurrency-conflict

This operation is incompatible with another asynchronous operation that is already in progress.

POSIX equivalent: EALREADY

not-in-progress

Trying to finish an asynchronous operation that:

  • has not been started yet, or:
  • was already finished by a previous finish-* call.

Note: this is scheduled to be removed when futures are natively supported.

would-block

The operation has been aborted because it could not be completed immediately.

Note: this is scheduled to be removed when futures are natively supported.

invalid-state

The operation is not valid in the socket's current state.

new-socket-limit

A new socket resource could not be created because of a system limit.

address-not-bindable

A bind operation failed because the provided address is not an address that the network can bind to.

address-in-use

A bind operation failed because the provided address is already in use or because there are no ephemeral ports available.

remote-unreachable

The remote address is not reachable

connection-refused

The TCP connection was forcefully rejected

connection-reset

The TCP connection was reset.

connection-aborted

A TCP connection was aborted.

datagram-too-large

The size of a datagram sent to a UDP socket exceeded the maximum supported size.

name-unresolvable

Name does not exist or has no suitable associated IP addresses.

temporary-resolver-failure

A temporary failure in name resolution occurred.

permanent-resolver-failure

A permanent failure in name resolution occurred.