# `Soundcheck.Check.Warning.UnhandledAsyncResult`
[🔗](https://github.com/leonqadirie/soundcheck/blob/v0.1.0/lib/soundcheck/check/warning/unhandled_async_result.ex#L1)

## Basics

> #### This check is disabled by default. {: .neutral}
>
> [Learn how to enable it](`e:credo:config_file.html#checks`) via `.credo.exs`.

This check has a base priority of `high` and works with any version of Elixir.

## Explanation

Flags `start_async/3` calls whose name no `handle_async/3` clause in
the same LiveView or LiveComponent accepts. When the task finishes,
LiveView calls `handle_async/3` with that name, and the missing clause
crashes the process.

Before:

    def mount(_params, _session, socket) do
      {:ok, start_async(socket, :load_stats, fn -> Stats.load() end)}
    end

    def handle_async(:load_users, result, socket), do: ...

After:

    def handle_async(:load_stats, {:ok, stats}, socket), do: ...

Names match when they are equal atoms or tuples with the same tag and
size; a `handle_async(name, ...)` catch-all accepts every name.

The check reads the compiled module's expanded AST, so it sees
handlers that `use` macros inject. Handlers attached with
`attach_hook/4` (in the module or its `on_mount` hooks) make the
finding unverifiable; it appears only in strict mode.

Confidence: high. Tier: semantic (run `mix compile` before `mix credo`).

## Check-Specific Parameters

Use the following parameters to configure this check:

### `:excluded_paths`

  Paths to skip (atoms, binaries as path segments, or regexes).

*This parameter defaults to* `[~r/\/test\//, "test"]`.

### `:strict`

  Report unverifiable findings too.

*This parameter defaults to* `false`.

## General Parameters

Like with all checks, [general params](`e:credo:check_params.html`) can be applied.

Parameters can be configured via the [`.credo.exs` config file](`e:credo:config_file.html`).

---

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