Skip to content

Commit eec6d39

Browse files
larrylvJosé Valim
authored and
José Valim
committed
Fix wrong error message when updating map for non exist key
``` elixir iex(7)> map = %{:a => 1, 2 => :b} %{2 => :b, :a => 1} iex(8)> %{map | :c => 3} ** (KeyError) key :c not found in: %{2 => :b, :a => 1} ```
1 parent 20419a8 commit eec6d39

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

getting-started/maps-and-dicts.markdown

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ iex> map.c
185185
iex> %{map | :a => 2}
186186
%{:a => 2, 2 => :b}
187187
iex> %{map | :c => 3}
188-
** (ArgumentError) argument error
188+
** (KeyError) key :c not found in: %{2 => :b, :a => 1}
189189
```
190190

191191
Both access and update syntaxes above require the given keys to exist. For example, accessing and updating the `:c` key failed because there is no `:c` in the map.

0 commit comments

Comments
 (0)