@@ -82,6 +82,11 @@ defmodule Exception do
82
82
83
83
@ doc """
84
84
Gets the message for an `exception`.
85
+
86
+ This function will invoke the `c:message/1` callback on the exception
87
+ module to retrieve the message. If the callback raises an exception or
88
+ returns a non-binary value, this function will rescue the error and
89
+ return a descriptive error message instead.
85
90
"""
86
91
@ spec message ( t ) :: String . t ( )
87
92
def message ( % module { __exception__: true } = exception ) do
@@ -153,7 +158,7 @@ defmodule Exception do
153
158
end
154
159
155
160
@ doc """
156
- Normalizes and formats throw /errors/exits and stacktraces.
161
+ Normalizes and formats throws /errors/exits and stacktraces.
157
162
158
163
It relies on `format_banner/3` and `format_stacktrace/1`
159
164
to generate the final format.
@@ -193,14 +198,18 @@ defmodule Exception do
193
198
end
194
199
195
200
@ doc """
196
- Attaches information to exceptions for extra debugging.
201
+ Attaches information to throws/errors/exits for extra debugging.
197
202
198
203
This operation is potentially expensive, as it reads data
199
204
from the file system, parses beam files, evaluates code and
200
205
so on.
201
206
202
- If the exception module implements the optional `c:blame/2`
203
- callback, it will be invoked to perform the computation.
207
+ If `kind` argument is `:error` and the `error` is an Erlang exception, this function will
208
+ normalize it. If the `error` argument is an Elixir exception, this function will invoke
209
+ the optional `c:blame/2` callback on the exception module if it is implemented.
210
+ Unlike `message/1`, this function will not rescue errors - if the callback raises an exception,
211
+ the error will propagate to the caller. It is your choice if you want to rescue and return
212
+ the original exception, return a different exception, or let it cascade.
204
213
"""
205
214
@ doc since: "1.5.0"
206
215
@ spec blame ( :error , any , stacktrace ) :: { t , stacktrace }
0 commit comments