# HostErrorCode

`import { HostErrorCode } from "destack:error";`

Error code returned by host bindings.

```ds title="HostErrorCode"
export enum HostErrorCode {
    InvalidArgument = 1000,
    InvalidArgumentType = 1001,
    InvalidArgumentValue = 1002,
    NullPointer = 1100,
    NotSupported = 1200,
    Io = 2000,
    IoReadFailed = 2100,
    IoWriteFailed = 2101,
    IoNotFound = 2102,
    IoPermissionDenied = 2103,
    IoAlreadyExists = 2104,
    IoNotDirectory = 2105,
    IoIsDirectory = 2106,
    IoNotEmpty = 2107,
    IoReadOnly = 2108,
    IoNameTooLong = 2109,
    IoFileTooLarge = 2110,
    IoTooManyOpenFiles = 2111,
    IoFileTableOverflow = 2112,
    IoInvalidData = 2113,
    IoCrossDevice = 2114,
    IoBrokenPipe = 2115,
    IoTimedOut = 2116,
    IoInterrupted = 2117,
    IoBusy = 2118,
    IoWouldBlock = 2119,
    Net = 3000,
    NetConnectionRefused = 3100,
    NetTimedOut = 3101,
    NetConnectionReset = 3102,
    NetAddressInUse = 3103,
    NetAddressNotAvailable = 3104,
    NetNetworkUnreachable = 3105,
    NetHostUnreachable = 3106,
    NetConnectionAborted = 3107,
    NetBrokenPipe = 3108,
    NetDnsFailed = 3109,
    NetNotConnected = 3110,
    NetAlreadyConnected = 3111,
    NetMessageTooLarge = 3112,
    NetNotSocket = 3113,
    NetProtocolError = 3114,
    NetInProgress = 3115,
    NetShutdown = 3116,
    NetUnsupportedFamily = 3117,
    NetUnsupportedProtocol = 3118,
    NetNoBufferSpace = 3119,
    Process = 4000,
    ProcessSpawnFailed = 4100,
    ProcessNotFound = 4101,
    ProcessPermissionDenied = 4102,
    ProcessExecFailed = 4103,
    ProcessWaitFailed = 4104,
    ProcessSignaled = 4105,
    ProcessTimedOut = 4106,
    Random = 5000,
    RandomUnavailable = 5100,
    Time = 6000,
    TimeUnavailable = 6100,
    Ipc = 7000,
    IpcMessageTooLarge = 7100,
    IpcTimedOut = 7101,
    IpcClosed = 7102,
    IpcWouldBlock = 7103,
    IpcAlreadyExists = 7104,
    Security = 7200,
    SecurityDenied = 7210,
    SecurityViolation = 7211,
    Ffi = 7400,
    FfiLibraryLoadFailed = 7410,
    FfiSymbolNotFound = 7411,
    FfiCallFailed = 7412,
    Device = 7500,
    DeviceUnavailable = 7510,
    Display = 7600,
    DisplayUnavailable = 7610,
    Audio = 7700,
    AudioUnavailable = 7710,
    Gpu = 7800,
    GpuUnavailable = 7810,
    GpuOutOfMemory = 7811,
    GpuDeviceLost = 7812,
    Resource = 7900,
    ResourceNotFound = 7910,
    ResourceClosed = 7911,
    ResourceBusy = 7912,
    ResourceTypeMismatch = 7913,
    IoDriver = 8000,
    IoSubmissionFailed = 8010,
    IoCompletionFailed = 8011,
    IoCancelled = 8012,
    Generic = 9000,
}
```

[language/library/src/error/host.ds:6:206](https://github.com/destack-sh/destack/blob/main/language/library/src/error/host.ds#L6-L206)

## Variants

### `InvalidArgument = 1000`

Unclassified invalid argument.

### `InvalidArgumentType = 1001`

Invalid argument type.

### `InvalidArgumentValue = 1002`

Invalid argument value.

### `NullPointer = 1100`

Null pointer passed across the host boundary.

### `NotSupported = 1200`

Feature is not supported.

### `Io = 2000`

Generic I/O error.

### `IoReadFailed = 2100`

I/O read failed.

### `IoWriteFailed = 2101`

I/O write failed.

### `IoNotFound = 2102`

File or resource not found.

### `IoPermissionDenied = 2103`

Permission denied.

### `IoAlreadyExists = 2104`

File or resource already exists.

### `IoNotDirectory = 2105`

Path component is not a directory.

### `IoIsDirectory = 2106`

Path points to a directory where a file is required.

### `IoNotEmpty = 2107`

Directory is not empty.

### `IoReadOnly = 2108`

Read-only file system.

### `IoNameTooLong = 2109`

Path name is too long.

### `IoFileTooLarge = 2110`

File is too large.

### `IoTooManyOpenFiles = 2111`

Too many open files.

### `IoFileTableOverflow = 2112`

System file table is full.

### `IoInvalidData = 2113`

Invalid data or format.

### `IoCrossDevice = 2114`

Cross-device link not permitted.

### `IoBrokenPipe = 2115`

Broken pipe.

### `IoTimedOut = 2116`

I/O timed out.

### `IoInterrupted = 2117`

I/O interrupted.

### `IoBusy = 2118`

Resource is busy.

### `IoWouldBlock = 2119`

Operation would block.

### `Net = 3000`

Generic network error.

### `NetConnectionRefused = 3100`

Connection refused.

### `NetTimedOut = 3101`

Connection timed out.

### `NetConnectionReset = 3102`

Connection reset.

### `NetAddressInUse = 3103`

Address already in use.

### `NetAddressNotAvailable = 3104`

Address not available.

### `NetNetworkUnreachable = 3105`

Network unreachable.

### `NetHostUnreachable = 3106`

Host unreachable.

### `NetConnectionAborted = 3107`

Connection aborted.

### `NetBrokenPipe = 3108`

Broken pipe.

### `NetDnsFailed = 3109`

DNS lookup failed.

### `NetNotConnected = 3110`

Socket is not connected.

### `NetAlreadyConnected = 3111`

Socket is already connected.

### `NetMessageTooLarge = 3112`

Message is too large for target transport.

### `NetNotSocket = 3113`

Handle is not a socket.

### `NetProtocolError = 3114`

Protocol operation failed.

### `NetInProgress = 3115`

Operation is in progress.

### `NetShutdown = 3116`

Socket is shutdown for this operation.

### `NetUnsupportedFamily = 3117`

Address family is not supported.

### `NetUnsupportedProtocol = 3118`

Protocol is not supported.

### `NetNoBufferSpace = 3119`

No buffer space available.

### `Process = 4000`

Generic process error.

### `ProcessSpawnFailed = 4100`

Process spawn failed.

### `ProcessNotFound = 4101`

Process not found.

### `ProcessPermissionDenied = 4102`

Process permission denied.

### `ProcessExecFailed = 4103`

Process exec failed.

### `ProcessWaitFailed = 4104`

Process wait failed.

### `ProcessSignaled = 4105`

Process terminated by signal.

### `ProcessTimedOut = 4106`

Process operation timed out.

### `Random = 5000`

Randomness error.

### `RandomUnavailable = 5100`

Randomness unavailable.

### `Time = 6000`

Time source error.

### `TimeUnavailable = 6100`

Time source unavailable.

### `Ipc = 7000`

Generic IPC error.

### `IpcMessageTooLarge = 7100`

IPC payload too large.

### `IpcTimedOut = 7101`

IPC operation timed out.

### `IpcClosed = 7102`

IPC endpoint is closed.

### `IpcWouldBlock = 7103`

IPC operation would block.

### `IpcAlreadyExists = 7104`

IPC resource already exists.

### `Security = 7200`

Generic security error.

### `SecurityDenied = 7210`

Security policy denied operation.

### `SecurityViolation = 7211`

Security policy violation.

### `Ffi = 7400`

Generic FFI error.

### `FfiLibraryLoadFailed = 7410`

FFI library load failed.

### `FfiSymbolNotFound = 7411`

FFI symbol not found.

### `FfiCallFailed = 7412`

FFI call failed.

### `Device = 7500`

Generic device error.

### `DeviceUnavailable = 7510`

Device unavailable.

### `Display = 7600`

Generic display error.

### `DisplayUnavailable = 7610`

Display unavailable.

### `Audio = 7700`

Generic audio error.

### `AudioUnavailable = 7710`

Audio device unavailable.

### `Gpu = 7800`

Generic GPU error.

### `GpuUnavailable = 7810`

GPU device unavailable.

### `GpuOutOfMemory = 7811`

GPU out of memory.

### `GpuDeviceLost = 7812`

GPU device lost.

### `Resource = 7900`

Generic resource-table error.

### `ResourceNotFound = 7910`

Resource not found.

### `ResourceClosed = 7911`

Resource already closed.

### `ResourceBusy = 7912`

Resource busy.

### `ResourceTypeMismatch = 7913`

Resource type mismatch.

### `IoDriver = 8000`

Generic I/O driver error.

### `IoSubmissionFailed = 8010`

I/O submission failed.

### `IoCompletionFailed = 8011`

I/O completion failed.

### `IoCancelled = 8012`

I/O operation canceled.

### `Generic = 9000`

Generic host error.
