elixir
Elixir Exceptions
Built-in exception and error types raised by the Elixir language, standard library, and BEAM runtime, including argument, arithmetic, pattern-match, and protocol errors.
25 codes
· All codes 25 codes
- ArgumentError ArgumentError Raised when an argument passed to a function is invalid, e.g. calling String.to_atom/1 with a non-binary argument.
- ArithmeticError ArithmeticError Raised when a function is called with a bad argument to an arithmetic operation, most commonly integer division or remainder by zero.
- BadArityError BadArityError Raised when a function is invoked with the wrong number of arguments, typically via apply/2 or apply/3 on an anonymous function.
- BadBooleanError BadBooleanError Raised when a non-boolean value is used with a strict boolean operator such as and/2, or/2, or not/1.
- BadFunctionError BadFunctionError Raised when a function that is expected to be an anonymous function, or has the wrong arity for how it is invoked, cannot be applied.
- BadMapError BadMapError Raised when a map is expected, e.g. when using the map[key] access syntax or the %{map | key: value} update syntax on a non-map value.
- BadStructError BadStructError Raised when a struct update (%SomeStruct{struct | key: value}) is attempted on a value that is not the expected struct.
- CaseClauseError CaseClauseError Raised when no clause in a case/2 expression matches the given value.
- CompileError CompileError Raised when there is a generic compile-time error, such as an undefined module attribute or invalid macro usage, that doesn't fit a more specific error type.
- CondClauseError CondClauseError Raised when no clause in a cond/1 expression evaluates to a truthy value and there is no catch-all clause.
- Enum.EmptyError Enum.EmptyError Raised by functions such as Enum.min/1, Enum.max/1, or Enum.random/1 when they are called on an empty enumerable.
- ErlangError ErlangError Raised to wrap an error value coming from Erlang code, when the value isn't already one of Elixir's built-in exception structs.
- File.Error File.Error Raised by the bang (!) variants of File module functions, such as File.read!/1 or File.write!/2, when the underlying POSIX file operation fails.
- FunctionClauseError FunctionClauseError Raised when a function is called with arguments that don't match any of its defined clauses.
- KeyError KeyError Raised when a key is not found, e.g. by Map.fetch!/2, Keyword.fetch!/2, or the map.key access syntax.
- MatchError MatchError Raised when a match (=/2) operation fails, i.e. the right-hand side value cannot be matched against the left-hand side pattern.
- Protocol.UndefinedError Protocol.UndefinedError Raised when a protocol (e.g. Enumerable, String.Chars) is dispatched on a value for which no implementation has been defined.
- RuntimeError RuntimeError The generic runtime exception, raised by raise/1 when given a plain string message and no other exception type is more specific.
- SyntaxError SyntaxError Raised by the compiler when source code contains invalid Elixir syntax, such as a malformed expression or a missing operator.
- SystemLimitError SystemLimitError Raised when a BEAM VM system limit has been reached, such as running out of atoms, process identifiers, or ETS tables.
- TokenMissingError TokenMissingError Raised by the compiler when source code is incomplete, such as an unclosed do block, string, or list, and more tokens are expected.
- TryClauseError TryClauseError Raised when the else clauses of a try/1 expression don't match the value returned from the main try body.
- UndefinedFunctionError UndefinedFunctionError Raised when a function is called that is not defined, or is defined with a different arity, in the target module.
- UnicodeConversionError UnicodeConversionError Raised when a conversion between Unicode representations, such as List.to_string/1 on invalid codepoints, fails.
- WithClauseError WithClauseError Raised when none of the clauses of a with/1 special form match, and there is no matching else clause to handle it.