檢視原始碼 WithClauseError 例外 (Elixir v1.16.2)
當 with/1
表達式中的項目與其 else
中定義的 ->
子句不符時引發的例外。
此例外的下列欄位為公開,可自由存取
例如,會為下列 with/1
引發此例外,因為 {:ok, 2}
項目與 else
中的 :error
或 {:error, _}
子句不符
with {:ok, 1} <- {:ok, 2} do
:woah
else
:error -> :error
{:error, _} -> :error
end