Skip to content

Commit 173a34d

Browse files
committed
Update try-catch-and-rescue.markdown
1 parent e35fbac commit 173a34d

File tree

1 file changed

+3
-7
lines changed

1 file changed

+3
-7
lines changed

getting-started/try-catch-and-rescue.markdown

+3-7
Original file line numberDiff line numberDiff line change
@@ -172,13 +172,9 @@ iex> try do
172172
** (RuntimeError) oops, something went wrong
173173
```
174174

175-
The `after` clause will be executed regardless of whether or not the
176-
tried block succeeds. Note, however, that if a linked process exits,
177-
this process will exit and the `after` clause will not get run. Thus,
178-
`after` provides only a soft guarantee. In this case, `after` works just
179-
fine, because the opened file is also linked to the current process and
180-
will always get closed if the current process crashes, independent of the
181-
`after` clause.
175+
The `after` clause will be executed regardless of whether or not the tried block succeeds. Note, however, that if a linked process exits,
176+
this process will exit and the `after` clause will not get run. Thus `after` provides only a soft guarantee. Luckily, files in Elixir are also linked to the current processes and therefore they will always get closed if the current process crashes, independent of the
177+
`after` clause. You will find the same to be true for other resources like ETS tables, sockets, ports and more.
182178

183179
Sometimes you may want to wrap the entire body of a function in a `try` construct, often to guarantee some code will be executed afterwards. In such cases, Elixir allows you to omit the `try` line:
184180

0 commit comments

Comments
 (0)