With/1 design patterns

The idiom is {:ok, value}, {:error, reason}

So the pattern match should focus on the contents of reason.

For example:

Process.monitor/1 will result in a general message of the format:

{:DOWN, ref, :process, object, reason}

where reason can take on values like :normal, :noproc or :noconnection, i.e. values that are highly distinct and imply their context. So it’s a good idea to follow the same practice with {:error, reason} tuples.