summaryrefslogtreecommitdiff
path: root/lib/stdlib/test/shell_docs_SUITE_data/unknown_erlang_raise_3_func.txt
blob: 407a06aab411d90a53522d0e83d18170154ca9cf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53

  -spec erlang:raise(Class, Reason, Stacktrace) -> badarg
                        when
                            Class :: error | exit | throw,
                            Reason :: term(),
                            Stacktrace :: raise_stacktrace().

  Types:
    -type raise_stacktrace() ::
          [{module(), atom(), arity() | [term()]} |
           {function(), [term()]}] |
          [{module(), atom(), arity() | [term()], [{atom(), term()}]} |
           {function(), [term()], [{atom(), term()}]}].

  Raises an exception of the specified class, reason, and call stack
  backtrace (stacktrace).

  Class is error, exit, or throw. So, if it were not for the
  stacktrace, erlang:raise(Class, Reason, Stacktrace) is
  equivalent to erlang:Class(Reason) (given that Class is a
  valid class).

  Reason can be any term.

  Stacktrace is a list as provided in a try-catch clause.

    try
        ...
    catch Class:Reason:Stacktrace ->
        ...
    end

  That is, a list of four-tuples {Module, Function, Arity | Args,
  Location}, where Module and Function are atoms, and the third
  element is an integer arity or an argument list. The stacktrace
  can also contain {Fun, Args, Location} tuples, where Fun is a
  local fun and Args is an argument list.

  Element Location at the end is optional. Omitting it is
  equivalent to specifying an empty list.

  The stacktrace is used as the exception stacktrace for the calling
  process; it is truncated to the current maximum stacktrace depth.

  As evaluating this function causes the process to terminate, it
  has no return value unless the arguments are invalid, in which
  case the function returns the error reason badarg. If you want
  to be sure not to return, you can call error(erlang:raise(Class,
  Reason, Stacktrace)) and hope to distinguish exceptions later.

  See the reference manual about errors and error handling for
  more information about exception classes and how to catch
  exceptions.