erl_error
Module
erl_error
Description
This module provides functions for pretty-printing errors and exceptions.
Data Types
format_options() =
#{column => column(),
stack_trim_fun => stack_trim_fun(),
format_fun => format_fun()}
#{column => column(),
stack_trim_fun => stack_trim_fun(),
format_fun => format_fun()}
A map with formatting options.
A fun used to trim the end of the stacktrace. It is called with module, function, and arity from an entry from the stacktrace. The fun is to return true if the entry should be trimmed, and false otherwise. The default value is:
fun(_, _, _) -> false end
A fun used to format function arguments for BIF and function calls. By default the following fun will be used:
fun(Term, I) -> io_lib:print(Term, I, 80, 30) end
Start column number. Default is 1.
format_exception(Class, Reason, StackTrace) -> unicode:chardata()
|
OTP 24.0 |
OTP 24.0 |
Types
Class = error | exit | throw
Reason = term()
StackTrace = [tuple()]
Options = format_options()
Format the error reason and stack back-trace caught using try ... catch in the same style as the shell formats them.
Example:
try do_something() catch C:R:Stk -> Message = erl_error:format_exception(C, R, Stk), io:format(LogFile, "~ts\n", [Message]) end