Skip to content

Commit 85e2845

Browse files
author
José Valim
committed
Merge pull request #1905 from jwarwick/exception_docs
Cleaning up Exception docs (and other Kernel doc typos)
2 parents e424f02 + c1bedd5 commit 85e2845

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

lib/elixir/lib/kernel.ex

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1500,7 +1500,7 @@ defmodule Kernel do
15001500
@doc """
15011501
Raises an error.
15021502
1503-
It calls `.exception` on the given argument passing
1503+
Calls `.exception` on the given argument passing
15041504
the args in order to retrieve the appropriate exception
15051505
structure.
15061506
@@ -1731,8 +1731,8 @@ defmodule Kernel do
17311731
17321732
* `:pretty` - if set to true enables pretty printing, defaults to false;
17331733
1734-
* `:width` - the width avaliable for inspect to lay out the data structure
1735-
representation. Defaults to the least of 80 and terminal width;
1734+
* `:width` - the width available for inspect to layout the data structure
1735+
representation. Defaults to the smaller of 80 or the terminal width;
17361736
17371737
## Examples
17381738
@@ -3181,7 +3181,7 @@ defmodule Kernel do
31813181
31823182
Exceptions are simply records with three differences:
31833183
3184-
1. Exceptions are required to defined a function `exception/1`
3184+
1. Exceptions are required to define a function `exception/1`
31853185
that receives keyword arguments and returns the exception.
31863186
This function is a callback usually invoked by `raise/2`;
31873187
@@ -3195,20 +3195,20 @@ defmodule Kernel do
31953195
31963196
## Raising exceptions
31973197
3198-
The most common way to raise an exception is via the raise
3198+
The most common way to raise an exception is via the `raise/2`
31993199
function:
32003200
32013201
defexception MyException, [:message]
32023202
raise MyException,
3203-
message: "did not get what expected, got: #{inspect value}"
3203+
message: "did not get what was expected, got: #{inspect value}"
32043204
3205-
In many cases though, it is more convenient to just pass the
3206-
expected value to raise and generate the message in the `exception/1`
3205+
In many cases it is more convenient to pass the
3206+
expected value to `raise` and generate the message in the `exception/1`
32073207
callback:
32083208
32093209
defexception MyException, [:message] do
32103210
def exception(opts) do
3211-
msg = "did not get what expected, got: #{inspect opts[:actual]}"
3211+
msg = "did not get what was expected, got: #{inspect opts[:actual]}"
32123212
MyException[message: msg]
32133213
end
32143214
end
@@ -3349,7 +3349,7 @@ defmodule Kernel do
33493349
specialized one.
33503350
33513351
Second, falling back to `Any` adds an extra lookup to all types,
3352-
which is unecessary overhead unless an implementation for Any is
3352+
which is unnecessary overhead unless an implementation for Any is
33533353
required.
33543354
33553355
## Types

0 commit comments

Comments
 (0)