<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE erlref SYSTEM "erlref.dtd">

<erlref>
  <header>
    <copyright>
      <year>2020</year>
      <year>2020</year>
      <holder>Ericsson AB, All Rights Reserved</holder>
    </copyright>
    <legalnotice>
  Licensed under the Apache License, Version 2.0 (the "License");
  you may not use this file except in compliance with the License.
  You may obtain a copy of the License at

      http://www.apache.org/licenses/LICENSE-2.0

  Unless required by applicable law or agreed to in writing, software
  distributed under the License is distributed on an "AS IS" BASIS,
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  See the License for the specific language governing permissions and
  limitations under the License.

  The Initial Developer of the Original Code is Ericsson AB.
    </legalnotice>

    <title>erl_error</title>
    <prepared>Bjorn Gustavsson</prepared>
    <responsible>Kenneth Lundin</responsible>
    <docno>1</docno>
    <approved></approved>
    <checked></checked>
    <date>2020-10-16</date>
    <rev>A</rev>
    <file>erl_error.xml</file>
  </header>
  <module since="OTP 24.0">erl_error</module>
  <modulesummary>Utilities for reporting errors.
  </modulesummary>

  <description>
    <p>This module provides functions for pretty-printing errors and exceptions.</p>
  </description>

  <datatypes>
    <datatype>
      <name name="format_options"/>
      <desc><p>A map with formatting options.</p></desc>
    </datatype>
    <datatype>
      <name name="stack_trim_fun"/>
      <desc><p>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 <c>true</c> if the entry
      should be trimmed, and <c>false</c> otherwise. The default value
      is:</p>
      <pre>
fun(_, _, _) -> false end</pre>
      </desc>
    </datatype>
    <datatype>
      <name name="format_fun"/>
      <desc><p>A fun used to format function arguments for BIF and function calls.
      By default the following fun will be used:</p>
      <pre>
fun(Term, I) -> io_lib:print(Term, I, 80, 30) end</pre>
      </desc>
    </datatype>
    <datatype>
      <name name="column"/>
      <desc><p>Start column number. Default is 1.</p></desc>
    </datatype>
  </datatypes>

  <funcs>
    <func>
      <name name="format_exception" arity="3" since="OTP 24.0"/>
      <name name="format_exception" arity="4" since="OTP 24.0"/>
      <fsummary>Format an exception.</fsummary>
      <desc>
        <p>Format the error reason and stack back-trace caught using
        <c>try</c> ... <c>catch</c> in the same style as the shell
	formats them.</p>
	<p>Example:</p>
	<pre>
try
    do_something()
catch
    C:R:Stk ->
        Message = erl_error:format_exception(C, R, Stk),
        io:format(LogFile, "~ts\n", [Message])
end</pre>
      </desc>
    </func>
  </funcs>
</erlref>
