Results from Plushie.Command.task/2 tasks.
Fields
tag- the user-defined atom tag from the commandresult-{:ok, value}on success,{:error, reason}on failure
Pattern matching
def update(model, %AsyncEvent{tag: :fetch, result: {:ok, data}}), do: ...
def update(model, %AsyncEvent{tag: :fetch, result: {:error, reason}}), do: ...
# Catch all async errors regardless of tag:
def update(model, %AsyncEvent{result: {:error, reason}}), do: ...