Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit ecfc1a4

Browse files
committed
Merge pull request elixir-lang#375 from tonini/clarify-raise-in-spawn
clarify statement about raising a message inside spawn/1
2 parents 97104c8 + 517ba87 commit ecfc1a4

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

getting_started/11.markdown

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,14 +105,17 @@ The most common form of spawning in Elixir is actually via `spawn_link/1`. Befor
105105

106106
```iex
107107
iex> spawn fn -> raise "oops" end
108+
109+
[error] Error in process <0.58.0> with exit value: ...
110+
108111
#PID<0.58.0>
109112
```
110113

111-
Well... nothing happened. That's because processes are isolated. If we want the failure in one process to propagate to another one, we should link them. This can be done with `spawn_link/1`:
114+
It merely logged an error but the spawning process is still running. That's because processes are isolated. If we want the failure in one process to propagate to another one, we should link them. This can be done with `spawn_link/1`:
112115

113116
```iex
114117
iex> spawn_link fn -> raise "oops" end
115-
#PID<0.60.0>
118+
116119
** (EXIT from #PID<0.41.0>) an exception was raised:
117120
** (RuntimeError) oops
118121
:erlang.apply/2

0 commit comments

Comments
 (0)