# `Monty.Frameworks.Utils.CommunicationUtils`
[🔗](https://github.com/d-led/ex.tbp.monty/blob/v0.1.0/packages/ex_tbp_monty_core/lib/monty/frameworks/utils/communication_utils.ex#L1)

Reading what came in over one channel.

Mirrors `tbp/monty/frameworks/utils/communication_utils.py`. A module given a
step's percepts gets them as a list, because a step can carry several — a
motor-only step carries none, a step where two sensors saw the object carries
two — and what a caller usually wants is the one from a particular channel.

Naming a channel that is not in the percepts is an error rather than a `nil`:
a caller asking for a channel it expected and not finding it has a bug, and
the error says which channel and what was there instead.

# `get_percept_from_channel`

```elixir
@spec get_percept_from_channel([Monty.Cmp.Message.t()], String.t()) ::
  {:ok, Monty.Cmp.Message.t()}
  | {:error, {:channel_not_found, String.t(), [String.t()]}}
```

The percept from `channel_name`, or an error naming the channels that did
arrive.

---

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