檢視原始碼 Protocol.UndefinedError 例外 (Elixir v1.16.2)

當特定值未實作協定時引發的例外。

此例外的下列欄位為公開,可自由存取

  • :protocol (module/0) - 未實作的協定
  • :value (term/0) - 未實作協定的值

例如,此程式碼

Enum.at("A string!", 0)

會引發下列例外

%Protocol.UndefinedError{
  protocol: Enumerable,
  value: "A string!",
  # ...
}