From 8799bbf2c0f644008828fb1000b72fafb3fa58ec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Gustavsson?= Date: Thu, 3 Mar 2011 13:02:50 +0100 Subject: Update documentation for erlang:raise/3 and erlang:get_stacktrace/0 --- erts/doc/src/erlang.xml | 35 +++++++++++++++++++++++++++++------ 1 file changed, 29 insertions(+), 6 deletions(-) (limited to 'erts/doc/src/erlang.xml') diff --git a/erts/doc/src/erlang.xml b/erts/doc/src/erlang.xml index b59fda7ef7..9b560f04c9 100644 --- a/erts/doc/src/erlang.xml +++ b/erts/doc/src/erlang.xml @@ -1282,17 +1282,18 @@ b - erlang:get_stacktrace() -> [{Module, Function, Arity | Args}] + erlang:get_stacktrace() -> [{Module, Function, Arity | Args, Location}] Get the call stack back-trace of the last exception Module = Function = atom() Arity = arity() Args = [term()] + Location = [{atom(),term()}]

Get the call stack back-trace (stacktrace) of the last exception in the calling process as a list of - {Module,Function,Arity} tuples. + {Module,Function,Arity,Location} tuples. The Arity field in the first tuple may be the argument list of that function call instead of an arity integer, depending on the exception.

@@ -1302,6 +1303,25 @@ b

The stacktrace is the same data as the catch operator returns, for example:

{'EXIT',{badarg,Stacktrace}} = catch abs(x)

+

Location is a (possibly empty) list of two-tuples that + may indicate the location in the source code of the function. + The first element is an atom that describes the type of + information in the second element. Currently the following + items may occur:

+ + file + +

The second element of the tuple is a string (list of + characters) representing the filename of the source file + of the function.

+
+ line + +

The second element of the tuple is the line number + (an integer greater than zero) in the source file + where the exception occurred or the function was called.

+
+

See also erlang:error/1 and erlang:error/2.

@@ -4095,11 +4115,14 @@ os_prompt% equivalent to erlang:Class(Reason). Reason is any term and Stacktrace is a list as returned from get_stacktrace(), that is a list of - 3-tuples {Module, Function, Arity | Args} where - Module and Function are atoms and the third - element is an integer arity or an argument list. The - stacktrace may also contain {Fun, Args} tuples where + 4-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 may also contain {Fun, + Args, Location} tuples where Fun is a local fun and Args is an argument list.

+

The Location element 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 will be truncated to the current maximum stacktrace depth.

-- cgit v1.2.3