# Errors

> UForm for JavaScript

Every error carries a `code` from the `Status` enum, spelled as the C library names it, so a caller branches on the identity of the fault:

```javascript
import { Model, Status } from "@unum-cloud/uform";

try {
  Model.loadRam("missing.safetensors");
} catch (error) {
  if (error.code === Status.Io) console.log("no such checkpoint");
}
```

`import * as uform from 'uform';`

## Status

What went wrong, one member per `uform_status_*_k` of the C interface and spelled as its canonical name.

```typescript
enum Status
```

Every error the library or this binding throws carries one as its `code`, so a caller branches on the identity of the fault rather than on which side of the boundary saw it. A [`Deferred`](#Deferred) also reports [`Success`](#Success), and [`Deferred`](#Deferred) until its call is final.

- `Success` = `&quot;success&quot;`
- `Deferred` = `&quot;deferred&quot;`
- `OutOfMemory` = `&quot;out-of-memory&quot;`
- `ShapeMismatch` = `&quot;shape-mismatch&quot;`
- `UnsupportedLayout` = `&quot;unsupported-layout&quot;`
- `UnknownKind` = `&quot;unknown-kind&quot;`
- `Io` = `&quot;io&quot;`
- `Device` = `&quot;device&quot;`
- `Malformed` = `&quot;malformed&quot;`
- `Internal` = `&quot;internal&quot;`
- `ConfigMismatch` = `&quot;config-mismatch&quot;`
- `Contended` = `&quot;contended&quot;`
- `Cancelled` = `&quot;cancelled&quot;`
- `Unsupported` = `&quot;unsupported&quot;`
- `InvalidArgument` = `&quot;invalid-argument&quot;`

## UFormError

An error thrown by the library or this binding, its `code` naming the failure.

```typescript
interface UFormError extends Error
```

- `code` `Status`

