# `NervesHubLink.Extensions.ErrorReports.Report`
[🔗](https://github.com/nerves-hub/nerves_hub_link/blob/v2.14.0/lib/nerves_hub_link/extensions/error_reports/report.ex#L5)

One error, in the shape NervesHub stores.

    %{
      "timestamp" => "2026-08-31T10:22:31.123456Z",
      "kind" => "error",
      "reason" => "** (RuntimeError) connection refused",
      "frames" => [%{"module" => "MyApp.Worker", "function" => "handle_info/2", ..}]
    }

## `timestamp`, `kind` and `reason` are required

A report missing any of them is dropped by the server, and dropped quietly:
no error back to the device and nothing in the UI. The timestamp is when the
device saw the error rather than when it managed to send it, which is the
whole point of a report that spent an hour in a buffer waiting for a
connection.

## Frames are not MFAs

`module` is a namespace string and `function` is a name string, because the
same shape has to carry a Rust agent's `nerves_hub_link::agent` /
`run_loop` and an ESP-IDF client's C frames. Nothing on the server reads
these as Elixir.

# `t`

```elixir
@type t() :: %{required(String.t()) =&gt; term()}
```

# `dropped_notice`

```elixir
@spec dropped_notice(pos_integer(), String.t() | nil) :: t()
```

A report saying how many were dropped, and when the gap opened.

`at` is the timestamp of the first report that was dropped, so the notice
sorts ahead of every report that survived it. It carries its
own grouping key, so a fleet's dropped-report notices land on one issue
instead of one per device.

# `from_caught`

```elixir
@spec from_caught(:error | :exit | :throw, term(), Exception.stacktrace(), keyword()) ::
  t()
```

Build a report from an error the application caught and wants recorded.

`kind` is `:error`, `:exit` or `:throw`, matching `Kernel.SpecialForms.try/1`.

# `from_log_event`

```elixir
@spec from_log_event(:logger.log_event()) :: t() | nil
```

Build a report from an OTP log event carrying a `:crash_reason`.

Returns `nil` for an event without one, which is every ordinary log line.

# `now`

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

The current time, in the format the server parses.

# `put_context`

```elixir
@spec put_context(t(), map() | nil) :: t()
```

Attach device context to a report that does not have any yet.

---

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