# `MishkaCmsCore.Runtime.ErrorStatus`
[🔗](https://github.com/mishka-group/mishka_cms_core/blob/v0.0.1/lib/mishka_cms_core/runtime/error_status.ex#L5)

What one entry of a site's Error Page answers for: an HTTP status code (`404`, `500`, …) or
`:offline`, the page an offline site shows its visitors.

`:offline` is not an HTTP code. The page it names is answered as a 503 by
`MishkaCms.Plugs.MaintenanceGate`, at whatever address the visitor asked for, and when a site has
no such entry the gate draws its built-in page instead.

It is the `status` field's type on `MishkaCmsCore.Runtime.ErrorPage` and
`MishkaCmsCore.Runtime.ErrorPageDraft`, so both store the same thing: a code stays a JSON number,
`:offline` is stored as `"offline"` and read back as the atom.

`parse/1` is the same reading for everything else that is handed a status as text — the builder's
`?status=`, the preview's error-code picker, the Code tab's `<!-- offline -->` markers.

# `t`

```elixir
@type t() :: integer() | :offline
```

# `choices`

```elixir
@spec choices() :: [{String.t(), String.t() | [{String.t(), integer()}]}]
```

The choices the Error Page form offers, `:offline` first, then the client and server error codes
by group, in the shape a Gervaz `:select` takes.

# `handle_change?`

# `label`

```elixir
@spec label(t()) :: String.t()
```

A status as a person reads it: `404 · Not Found`, or `Offline`.

# `offline`

```elixir
@spec offline() :: :offline
```

The status of the page an offline site shows.

# `offline_entry?`

```elixir
@spec offline_entry?([map()]) :: boolean()
```

Whether a list of Error Page entries holds the `:offline` one, however its status was spelled.

# `parse`

```elixir
@spec parse(term()) :: t() | nil
```

A status from whatever spelled it, or `nil` when it names none.

    iex> MishkaCmsCore.Runtime.ErrorStatus.parse("404")
    404
    iex> MishkaCmsCore.Runtime.ErrorStatus.parse("offline")
    :offline
    iex> MishkaCmsCore.Runtime.ErrorStatus.parse("teapot")
    nil

# `prepare_change?`

---

*Consult [api-reference.md](api-reference.md) for complete listing*
