Sophie

Sophie

distrib > Mageia > 7 > i586 > media > core-release > by-pkgid > 016232f1d9a3f7bee85855d35a2bca58 > files > 56

elixir-doc-1.7.2-1.mga7.noarch.rpm

<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="utf-8">
    <meta http-equiv="x-ua-compatible" content="ie=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta name="generator" content="ExDoc v0.19.1">
    <title>Exception – Elixir v1.7.2</title>
    <link rel="stylesheet" href="dist/app-240d7fc7e5.css" />
      <link rel="canonical" href="https://hexdocs.pm/elixir/v1.7/Exception.html" />
    <script src="dist/sidebar_items-cdf4e58b19.js"></script>
    
  </head>
  <body data-type="modules">
    <script>try { if(localStorage.getItem('night-mode')) document.body.className += ' night-mode'; } catch (e) { }</script>
    <div class="main">
<button class="sidebar-button sidebar-toggle">
  <span class="icon-menu" aria-hidden="true"></span>
  <span class="sr-only">Toggle Sidebar</span>
</button>
<button class="sidebar-button night-mode-toggle">
  <span class="icon-theme" aria-hidden="true"></span>
  <span class="sr-only">Toggle Theme</span>
</button>
<section class="sidebar">

  <a href="http://elixir-lang.org/docs.html" class="sidebar-projectLink">
    <div class="sidebar-projectDetails">
      <h1 class="sidebar-projectName">
Elixir      </h1>
      <h2 class="sidebar-projectVersion">
        v1.7.2
      </h2>
    </div>
      <img src="assets/logo.png" alt="Elixir" class="sidebar-projectImage">
  </a>

  <form class="sidebar-search" action="search.html">
    <button type="submit" class="search-button">
      <span class="icon-search" aria-hidden="true"></span>
    </button>
    <input name="q" type="text" id="search-list" class="search-input" placeholder="Search" aria-label="Search" autocomplete="off" />
  </form>

  <ul class="sidebar-listNav">
    <li><a id="extras-list" href="#full-list">Pages</a></li>

      <li><a id="modules-list" href="#full-list">Modules</a></li>

      <li><a id="exceptions-list" href="#full-list">Exceptions</a></li>

  </ul>
  <div class="gradient"></div>
  <ul id="full-list" class="sidebar-fullList"></ul>
</section>

<section class="content">
  <div class="content-outer">
    <div id="content" class="content-inner">


      <h1>
        <small class="visible-xs">Elixir v1.7.2</small>
Exception <small>behaviour</small>        
          <a href="https://github.com/elixir-lang/elixir/blob/v1.7.2/lib/elixir/lib/exception.ex#L1" title="View Source" class="view-source" rel="help">
            <span class="icon-code" aria-hidden="true"></span>
            <span class="sr-only">View Source</span>
          </a>
      </h1>


        <section id="moduledoc">
<p>Functions to format throw/catch/exit and exceptions.</p>
<p>Note that stacktraces in Elixir are only available inside
catch and rescue by using the <a href="Kernel.SpecialForms.html#__STACKTRACE__/0"><code class="inline">__STACKTRACE__/0</code></a> variable.</p>
<p>Do not rely on the particular format returned by the <code class="inline">format*</code>
functions in this module. They may be changed in future releases
in order to better suit Elixir’s tool chain. In other words,
by using the functions in this module it is guaranteed you will
format exceptions as in the current Elixir version being used.</p>
        </section>

        <section id="summary" class="details-list">
          <h1 class="section-heading">
            <a class="hover-link" href="#summary">
              <span class="icon-link" aria-hidden="true"></span>
              <span class="sr-only">Link to this section</span>
            </a>
            Summary
          </h1>
  <div class="summary-types summary">
    <h2>
      <a href="#types">Types</a>
    </h2>
<div class="summary-row">
  <div class="summary-signature">
    <a href="#t:kind/0">kind()</a>
  </div>
    <div class="summary-synopsis"><p>The kind handled by formatting functions</p>
</div>
</div>
<div class="summary-row">
  <div class="summary-signature">
    <a href="#t:stacktrace/0">stacktrace()</a>
  </div>
</div>
<div class="summary-row">
  <div class="summary-signature">
    <a href="#t:stacktrace_entry/0">stacktrace_entry()</a>
  </div>
</div>
<div class="summary-row">
  <div class="summary-signature">
    <a href="#t:t/0">t()</a>
  </div>
    <div class="summary-synopsis"><p>The exception type</p>
</div>
</div>
  </div>
          
  <div class="summary-functions summary">
    <h2>
      <a href="#functions">Functions</a>
    </h2>
<div class="summary-row">
  <div class="summary-signature">
    <a href="#blame/3">blame(kind, error, stacktrace)</a>
  </div>
    <div class="summary-synopsis"><p>Attaches information to exceptions for extra debugging</p>
</div>
</div>
<div class="summary-row">
  <div class="summary-signature">
    <a href="#blame_mfa/3">blame_mfa(module, function, args)</a>
  </div>
    <div class="summary-synopsis"><p>Blames the invocation of the given module, function and arguments</p>
</div>
</div>
<div class="summary-row">
  <div class="summary-signature">
    <a href="#exception?/1">exception?(term)</a>
  </div>
    <div class="summary-synopsis"><p>Returns <code class="inline">true</code> if the given <code class="inline">term</code> is an exception</p>
</div>
</div>
<div class="summary-row">
  <div class="summary-signature">
    <a href="#format/3">format(kind, payload, stacktrace \\ [])</a>
  </div>
    <div class="summary-synopsis"><p>Normalizes and formats throw/errors/exits and stacktraces</p>
</div>
</div>
<div class="summary-row">
  <div class="summary-signature">
    <a href="#format_banner/3">format_banner(kind, exception, stacktrace \\ [])</a>
  </div>
    <div class="summary-synopsis"><p>Normalizes and formats any throw/error/exit</p>
</div>
</div>
<div class="summary-row">
  <div class="summary-signature">
    <a href="#format_exit/1">format_exit(reason)</a>
  </div>
    <div class="summary-synopsis"><p>Formats an exit. It returns a string</p>
</div>
</div>
<div class="summary-row">
  <div class="summary-signature">
    <a href="#format_fa/2">format_fa(fun, arity)</a>
  </div>
    <div class="summary-synopsis"><p>Receives an anonymous function and arity and formats it as
shown in stacktraces. The arity may also be a list of arguments</p>
</div>
</div>
<div class="summary-row">
  <div class="summary-signature">
    <a href="#format_file_line/3">format_file_line(file, line, suffix \\ &quot;&quot;)</a>
  </div>
    <div class="summary-synopsis"><p>Formats the given <code class="inline">file</code> and <code class="inline">line</code> as shown in stacktraces.
If any of the values are <code class="inline">nil</code>, they are omitted</p>
</div>
</div>
<div class="summary-row">
  <div class="summary-signature">
    <a href="#format_mfa/3">format_mfa(module, fun, arity)</a>
  </div>
    <div class="summary-synopsis"><p>Receives a module, fun and arity and formats it
as shown in stacktraces. The arity may also be a list
of arguments</p>
</div>
</div>
<div class="summary-row">
  <div class="summary-signature">
    <a href="#format_stacktrace/1">format_stacktrace(trace \\ nil)</a>
  </div>
    <div class="summary-synopsis"><p>Formats the stacktrace</p>
</div>
</div>
<div class="summary-row">
  <div class="summary-signature">
    <a href="#format_stacktrace_entry/1">format_stacktrace_entry(entry)</a>
  </div>
    <div class="summary-synopsis"><p>Receives a stacktrace entry and formats it into a string</p>
</div>
</div>
<div class="summary-row">
  <div class="summary-signature">
    <a href="#message/1">message(exception)</a>
  </div>
    <div class="summary-synopsis"><p>Gets the message for an <code class="inline">exception</code></p>
</div>
</div>
<div class="summary-row">
  <div class="summary-signature">
    <a href="#normalize/3">normalize(kind, payload, stacktrace \\ [])</a>
  </div>
    <div class="summary-synopsis"><p>Normalizes an exception, converting Erlang exceptions
to Elixir exceptions</p>
</div>
</div>
  </div>
            <div class="summary-callbacks summary">
    <h2>
      <a href="#callbacks">Callbacks</a>
    </h2>
<div class="summary-row">
  <div class="summary-signature">
    <a href="#c:blame/2">blame(t, stacktrace)</a>
  </div>
    <div class="summary-synopsis"><p>Called from <a href="Exception.html#blame/3"><code class="inline">Exception.blame/3</code></a> to augment the exception struct</p>
</div>
</div>
<div class="summary-row">
  <div class="summary-signature">
    <a href="#c:exception/1">exception(term)</a>
  </div>
</div>
<div class="summary-row">
  <div class="summary-signature">
    <a href="#c:message/1">message(t)</a>
  </div>
</div>
  </div>

        </section>

        <section id="types" class="details-list">
          <h1 class="section-heading">
            <a class="hover-link" href="#types">
              <span class="icon-link" aria-hidden="true"></span>
              <span class="sr-only">Link to this section</span>
            </a>
            Types
          </h1>
          <div class="types-list">
<div class="detail" id="t:kind/0">
    <div class="detail-header">
    <a href="#t:kind/0" class="detail-link" title="Link to this type">
      <span class="icon-link" aria-hidden="true"></span>
      <span class="sr-only">Link to this type</span>
    </a>
    <span class="signature">kind()</span>
      <a href="https://github.com/elixir-lang/elixir/blob/v1.7.2/lib/elixir/lib/exception.ex#L23" class="view-source" rel="help" title="View Source">
       <span class="icon-code" aria-hidden="true"></span>
       <span class="sr-only">View Source</span>
     </a>
        
      <div class="specs">
          <pre>kind() :: :error | non_error_kind()</pre>
      </div>
  </div>
  <section class="docstring">
<p>The kind handled by formatting functions</p>
  </section>
</div>
<div class="detail" id="t:stacktrace/0">
    <div class="detail-header">
    <a href="#t:stacktrace/0" class="detail-link" title="Link to this type">
      <span class="icon-link" aria-hidden="true"></span>
      <span class="sr-only">Link to this type</span>
    </a>
    <span class="signature">stacktrace()</span>
      <a href="https://github.com/elixir-lang/elixir/blob/v1.7.2/lib/elixir/lib/exception.ex#L26" class="view-source" rel="help" title="View Source">
       <span class="icon-code" aria-hidden="true"></span>
       <span class="sr-only">View Source</span>
     </a>
        
      <div class="specs">
          <pre>stacktrace() :: [<a href="#t:stacktrace_entry/0">stacktrace_entry</a>()]</pre>
      </div>
  </div>
  <section class="docstring">
  </section>
</div>
<div class="detail" id="t:stacktrace_entry/0">
    <div class="detail-header">
    <a href="#t:stacktrace_entry/0" class="detail-link" title="Link to this type">
      <span class="icon-link" aria-hidden="true"></span>
      <span class="sr-only">Link to this type</span>
    </a>
    <span class="signature">stacktrace_entry()</span>
      <a href="https://github.com/elixir-lang/elixir/blob/v1.7.2/lib/elixir/lib/exception.ex#L27" class="view-source" rel="help" title="View Source">
       <span class="icon-code" aria-hidden="true"></span>
       <span class="sr-only">View Source</span>
     </a>
        
      <div class="specs">
          <pre>stacktrace_entry() ::
  {<a href="typespecs.html#built-in-types">module</a>(), <a href="typespecs.html#basic-types">atom</a>(), arity_or_args(), location()}
  | {(... -> <a href="typespecs.html#basic-types">any</a>()), arity_or_args(), location()}</pre>
      </div>
  </div>
  <section class="docstring">
  </section>
</div>
<div class="detail" id="t:t/0">
    <div class="detail-header">
    <a href="#t:t/0" class="detail-link" title="Link to this type">
      <span class="icon-link" aria-hidden="true"></span>
      <span class="sr-only">Link to this type</span>
    </a>
    <span class="signature">t()</span>
      <a href="https://github.com/elixir-lang/elixir/blob/v1.7.2/lib/elixir/lib/exception.ex#L16" class="view-source" rel="help" title="View Source">
       <span class="icon-code" aria-hidden="true"></span>
       <span class="sr-only">View Source</span>
     </a>
        
      <div class="specs">
          <pre>t() :: %<a href="typespecs.html#built-in-types">module</a>(){:__exception__ => true, optional(<a href="typespecs.html#basic-types">atom</a>()) => <a href="typespecs.html#basic-types">any</a>()}</pre>
      </div>
  </div>
  <section class="docstring">
<p>The exception type</p>
  </section>
</div>
          </div>
        </section>


        <section id="functions" class="details-list">
          <h1 class="section-heading">
            <a class="hover-link" href="#functions">
              <span class="icon-link" aria-hidden="true"></span>
              <span class="sr-only">Link to this section</span>
            </a>
            Functions
          </h1>
<div class="detail" id="blame/3">
    <div class="detail-header">
    <a href="#blame/3" class="detail-link" title="Link to this function">
      <span class="icon-link" aria-hidden="true"></span>
      <span class="sr-only">Link to this function</span>
    </a>
    <span class="signature">blame(kind, error, stacktrace)</span>
      <a href="https://github.com/elixir-lang/elixir/blob/v1.7.2/lib/elixir/lib/exception.ex#L174" class="view-source" rel="help" title="View Source">
       <span class="icon-code" aria-hidden="true"></span>
       <span class="sr-only">View Source</span>
     </a>
    
      <span class="note">(since 1.5.0)</span>
    
      <div class="specs">
          <pre>blame(:error, <a href="typespecs.html#basic-types">any</a>(), <a href="#t:stacktrace/0">stacktrace</a>()) :: {<a href="#t:t/0">t</a>(), <a href="#t:stacktrace/0">stacktrace</a>()}</pre>
          <pre>blame(non_error_kind(), payload, <a href="#t:stacktrace/0">stacktrace</a>()) :: {payload, <a href="#t:stacktrace/0">stacktrace</a>()}
when payload: var</pre>
      </div>
  </div>
  <section class="docstring">
<p>Attaches information to exceptions for extra debugging.</p>
<p>This operation is potentially expensive, as it reads data
from the filesystem, parses beam files, evaluates code and
so on.</p>
<p>If the exception module implements the optional <a href="#c:blame/2"><code class="inline">blame/2</code></a>
callback, it will be invoked to perform the computation.</p>
  </section>
</div>
<div class="detail" id="blame_mfa/3">
    <div class="detail-header">
    <a href="#blame_mfa/3" class="detail-link" title="Link to this function">
      <span class="icon-link" aria-hidden="true"></span>
      <span class="sr-only">Link to this function</span>
    </a>
    <span class="signature">blame_mfa(module, function, args)</span>
      <a href="https://github.com/elixir-lang/elixir/blob/v1.7.2/lib/elixir/lib/exception.ex#L196" class="view-source" rel="help" title="View Source">
       <span class="icon-code" aria-hidden="true"></span>
       <span class="sr-only">View Source</span>
     </a>
    
      <span class="note">(since 1.5.0)</span>
    
      <div class="specs">
          <pre>blame_mfa(<a href="typespecs.html#built-in-types">module</a>(), <a href="typespecs.html#built-in-types">function</a>(), args :: [<a href="typespecs.html#built-in-types">term</a>()]) ::
  {:ok, :def | :defp | :defmacro | :defmacrop,
   [{args :: [<a href="typespecs.html#built-in-types">term</a>()], guards :: [<a href="typespecs.html#built-in-types">term</a>()]}]}
  | :error</pre>
      </div>
  </div>
  <section class="docstring">
<p>Blames the invocation of the given module, function and arguments.</p>
<p>This function will retrieve the available clauses from bytecode
and evaluate them against the given arguments. The clauses are
returned as a list of <code class="inline">{args, guards}</code> pairs where each argument
and each top-level condition in a guard separated by <code class="inline">and</code>/<code class="inline">or</code>
is wrapped in a tuple with blame metadata.</p>
<p>This function returns either <code class="inline">{:ok, definition, clauses}</code> or <code class="inline">:error</code>.
Where <code class="inline">definition</code> is <code class="inline">:def</code>, <code class="inline">:defp</code>, <code class="inline">:defmacro</code> or <code class="inline">:defmacrop</code>.
Note this functionality requires Erlang/OTP 20, otherwise <code class="inline">:error</code>
is always returned.</p>
  </section>
</div>
<div class="detail" id="exception?/1">
    <div class="detail-header">
    <a href="#exception?/1" class="detail-link" title="Link to this function">
      <span class="icon-link" aria-hidden="true"></span>
      <span class="sr-only">Link to this function</span>
    </a>
    <span class="signature">exception?(term)</span>
      <a href="https://github.com/elixir-lang/elixir/blob/v1.7.2/lib/elixir/lib/exception.ex#L51" class="view-source" rel="help" title="View Source">
       <span class="icon-code" aria-hidden="true"></span>
       <span class="sr-only">View Source</span>
     </a>
          </div>
  <section class="docstring">
<p>Returns <code class="inline">true</code> if the given <code class="inline">term</code> is an exception.</p>
  </section>
</div>
<div class="detail" id="format/3">
  
    <span id="format/2"></span>
  <div class="detail-header">
    <a href="#format/3" class="detail-link" title="Link to this function">
      <span class="icon-link" aria-hidden="true"></span>
      <span class="sr-only">Link to this function</span>
    </a>
    <span class="signature">format(kind, payload, stacktrace \\ [])</span>
      <a href="https://github.com/elixir-lang/elixir/blob/v1.7.2/lib/elixir/lib/exception.ex#L140" class="view-source" rel="help" title="View Source">
       <span class="icon-code" aria-hidden="true"></span>
       <span class="sr-only">View Source</span>
     </a>
        
      <div class="specs">
          <pre>format(<a href="#t:kind/0">kind</a>(), <a href="typespecs.html#basic-types">any</a>(), <a href="#t:stacktrace/0">stacktrace</a>()) :: <a href="String.html#t:t/0">String.t</a>()</pre>
      </div>
  </div>
  <section class="docstring">
<p>Normalizes and formats throw/errors/exits and stacktraces.</p>
<p>It relies on <a href="#format_banner/3"><code class="inline">format_banner/3</code></a> and <a href="#format_stacktrace/1"><code class="inline">format_stacktrace/1</code></a>
to generate the final format.</p>
<p>If <code class="inline">kind</code> is <code class="inline">{:EXIT, pid}</code>, it does not generate a stacktrace,
as such exits are retrieved as messages without stacktraces.</p>
  </section>
</div>
<div class="detail" id="format_banner/3">
  
    <span id="format_banner/2"></span>
  <div class="detail-header">
    <a href="#format_banner/3" class="detail-link" title="Link to this function">
      <span class="icon-link" aria-hidden="true"></span>
      <span class="sr-only">Link to this function</span>
    </a>
    <span class="signature">format_banner(kind, exception, stacktrace \\ [])</span>
      <a href="https://github.com/elixir-lang/elixir/blob/v1.7.2/lib/elixir/lib/exception.ex#L120" class="view-source" rel="help" title="View Source">
       <span class="icon-code" aria-hidden="true"></span>
       <span class="sr-only">View Source</span>
     </a>
        
      <div class="specs">
          <pre>format_banner(<a href="#t:kind/0">kind</a>(), <a href="typespecs.html#basic-types">any</a>(), <a href="#t:stacktrace/0">stacktrace</a>()) :: <a href="String.html#t:t/0">String.t</a>()</pre>
      </div>
  </div>
  <section class="docstring">
<p>Normalizes and formats any throw/error/exit.</p>
<p>The message is formatted and displayed in the same
format as used by Elixir’s CLI.</p>
<p>The third argument is the stacktrace which is used to enrich
a normalized error with more information. It is only used when
the kind is an error.</p>
  </section>
</div>
<div class="detail" id="format_exit/1">
    <div class="detail-header">
    <a href="#format_exit/1" class="detail-link" title="Link to this function">
      <span class="icon-link" aria-hidden="true"></span>
      <span class="sr-only">Link to this function</span>
    </a>
    <span class="signature">format_exit(reason)</span>
      <a href="https://github.com/elixir-lang/elixir/blob/v1.7.2/lib/elixir/lib/exception.ex#L323" class="view-source" rel="help" title="View Source">
       <span class="icon-code" aria-hidden="true"></span>
       <span class="sr-only">View Source</span>
     </a>
        
      <div class="specs">
          <pre>format_exit(<a href="typespecs.html#basic-types">any</a>()) :: <a href="String.html#t:t/0">String.t</a>()</pre>
      </div>
  </div>
  <section class="docstring">
<p>Formats an exit. It returns a string.</p>
<p>Often there are errors/exceptions inside exits. Exits are often
wrapped by the caller and provide stacktraces too. This function
formats exits in a way to nicely show the exit reason, caller
and stacktrace.</p>
  </section>
</div>
<div class="detail" id="format_fa/2">
    <div class="detail-header">
    <a href="#format_fa/2" class="detail-link" title="Link to this function">
      <span class="icon-link" aria-hidden="true"></span>
      <span class="sr-only">Link to this function</span>
    </a>
    <span class="signature">format_fa(fun, arity)</span>
      <a href="https://github.com/elixir-lang/elixir/blob/v1.7.2/lib/elixir/lib/exception.ex#L586" class="view-source" rel="help" title="View Source">
       <span class="icon-code" aria-hidden="true"></span>
       <span class="sr-only">View Source</span>
     </a>
          </div>
  <section class="docstring">
<p>Receives an anonymous function and arity and formats it as
shown in stacktraces. The arity may also be a list of arguments.</p>
<h2 id="format_fa/2-examples" class="section-heading">
  <a href="#format_fa/2-examples" class="hover-link"><span class="icon-link" aria-hidden="true"></span></a>
  Examples
</h2>

<pre><code class="nohighlight makeup elixir"><span class="nc">Exception</span><span class="o">.</span><span class="n">format_fa</span><span class="p" data-group-id="7438568496-1">(</span><span class="k" data-group-id="7438568496-2">fn</span><span class="w"> </span><span class="o">-&gt;</span><span class="w"> </span><span class="no">nil</span><span class="w"> </span><span class="k" data-group-id="7438568496-2">end</span><span class="p">,</span><span class="w"> </span><span class="mi">1</span><span class="p" data-group-id="7438568496-1">)</span><span class="w">
</span><span class="c1">#=&gt; &quot;#Function&lt;...&gt;/1&quot;</span></code></pre>
  </section>
</div>
<div class="detail" id="format_file_line/3">
  
    <span id="format_file_line/2"></span>
  <div class="detail-header">
    <a href="#format_file_line/3" class="detail-link" title="Link to this function">
      <span class="icon-link" aria-hidden="true"></span>
      <span class="sr-only">Link to this function</span>
    </a>
    <span class="signature">format_file_line(file, line, suffix \\ &quot;&quot;)</span>
      <a href="https://github.com/elixir-lang/elixir/blob/v1.7.2/lib/elixir/lib/exception.ex#L648" class="view-source" rel="help" title="View Source">
       <span class="icon-code" aria-hidden="true"></span>
       <span class="sr-only">View Source</span>
     </a>
          </div>
  <section class="docstring">
<p>Formats the given <code class="inline">file</code> and <code class="inline">line</code> as shown in stacktraces.
If any of the values are <code class="inline">nil</code>, they are omitted.</p>
<h2 id="format_file_line/3-examples" class="section-heading">
  <a href="#format_file_line/3-examples" class="hover-link"><span class="icon-link" aria-hidden="true"></span></a>
  Examples
</h2>

<pre><code class="nohighlight makeup elixir"><span class="gp unselectable">iex&gt; </span><span class="nc">Exception</span><span class="o">.</span><span class="n">format_file_line</span><span class="p" data-group-id="8570193482-1">(</span><span class="s">&quot;foo&quot;</span><span class="p">,</span><span class="w"> </span><span class="mi">1</span><span class="p" data-group-id="8570193482-1">)</span><span class="w">
</span><span class="s">&quot;foo:1:&quot;</span><span class="w">

</span><span class="gp unselectable">iex&gt; </span><span class="nc">Exception</span><span class="o">.</span><span class="n">format_file_line</span><span class="p" data-group-id="8570193482-2">(</span><span class="s">&quot;foo&quot;</span><span class="p">,</span><span class="w"> </span><span class="no">nil</span><span class="p" data-group-id="8570193482-2">)</span><span class="w">
</span><span class="s">&quot;foo:&quot;</span><span class="w">

</span><span class="gp unselectable">iex&gt; </span><span class="nc">Exception</span><span class="o">.</span><span class="n">format_file_line</span><span class="p" data-group-id="8570193482-3">(</span><span class="no">nil</span><span class="p">,</span><span class="w"> </span><span class="no">nil</span><span class="p" data-group-id="8570193482-3">)</span><span class="w">
</span><span class="s">&quot;&quot;</span></code></pre>
  </section>
</div>
<div class="detail" id="format_mfa/3">
    <div class="detail-header">
    <a href="#format_mfa/3" class="detail-link" title="Link to this function">
      <span class="icon-link" aria-hidden="true"></span>
      <span class="sr-only">Link to this function</span>
    </a>
    <span class="signature">format_mfa(module, fun, arity)</span>
      <a href="https://github.com/elixir-lang/elixir/blob/v1.7.2/lib/elixir/lib/exception.ex#L610" class="view-source" rel="help" title="View Source">
       <span class="icon-code" aria-hidden="true"></span>
       <span class="sr-only">View Source</span>
     </a>
          </div>
  <section class="docstring">
<p>Receives a module, fun and arity and formats it
as shown in stacktraces. The arity may also be a list
of arguments.</p>
<h2 id="format_mfa/3-examples" class="section-heading">
  <a href="#format_mfa/3-examples" class="hover-link"><span class="icon-link" aria-hidden="true"></span></a>
  Examples
</h2>

<pre><code class="nohighlight makeup elixir"><span class="gp unselectable">iex&gt; </span><span class="nc">Exception</span><span class="o">.</span><span class="n">format_mfa</span><span class="p" data-group-id="0388192562-1">(</span><span class="nc">Foo</span><span class="p">,</span><span class="w"> </span><span class="ss">:bar</span><span class="p">,</span><span class="w"> </span><span class="mi">1</span><span class="p" data-group-id="0388192562-1">)</span><span class="w">
</span><span class="s">&quot;Foo.bar/1&quot;</span><span class="w">

</span><span class="gp unselectable">iex&gt; </span><span class="nc">Exception</span><span class="o">.</span><span class="n">format_mfa</span><span class="p" data-group-id="0388192562-2">(</span><span class="nc">Foo</span><span class="p">,</span><span class="w"> </span><span class="ss">:bar</span><span class="p">,</span><span class="w"> </span><span class="p" data-group-id="0388192562-3">[</span><span class="p" data-group-id="0388192562-3">]</span><span class="p" data-group-id="0388192562-2">)</span><span class="w">
</span><span class="s">&quot;Foo.bar()&quot;</span><span class="w">

</span><span class="gp unselectable">iex&gt; </span><span class="nc">Exception</span><span class="o">.</span><span class="n">format_mfa</span><span class="p" data-group-id="0388192562-4">(</span><span class="no">nil</span><span class="p">,</span><span class="w"> </span><span class="ss">:bar</span><span class="p">,</span><span class="w"> </span><span class="p" data-group-id="0388192562-5">[</span><span class="p" data-group-id="0388192562-5">]</span><span class="p" data-group-id="0388192562-4">)</span><span class="w">
</span><span class="s">&quot;nil.bar()&quot;</span></code></pre>
<p>Anonymous functions are reported as -func/arity-anonfn-count-,
where func is the name of the enclosing function. Convert to
“anonymous fn in func/arity”</p>
  </section>
</div>
<div class="detail" id="format_stacktrace/1">
  
    <span id="format_stacktrace/0"></span>
  <div class="detail-header">
    <a href="#format_stacktrace/1" class="detail-link" title="Link to this function">
      <span class="icon-link" aria-hidden="true"></span>
      <span class="sr-only">Link to this function</span>
    </a>
    <span class="signature">format_stacktrace(trace \\ nil)</span>
      <a href="https://github.com/elixir-lang/elixir/blob/v1.7.2/lib/elixir/lib/exception.ex#L560" class="view-source" rel="help" title="View Source">
       <span class="icon-code" aria-hidden="true"></span>
       <span class="sr-only">View Source</span>
     </a>
          </div>
  <section class="docstring">
<p>Formats the stacktrace.</p>
<p>A stacktrace must be given as an argument. If not, the stacktrace
is retrieved from <a href="Process.html#info/2"><code class="inline">Process.info/2</code></a>.</p>
  </section>
</div>
<div class="detail" id="format_stacktrace_entry/1">
    <div class="detail-header">
    <a href="#format_stacktrace_entry/1" class="detail-link" title="Link to this function">
      <span class="icon-link" aria-hidden="true"></span>
      <span class="sr-only">Link to this function</span>
    </a>
    <span class="signature">format_stacktrace_entry(entry)</span>
      <a href="https://github.com/elixir-lang/elixir/blob/v1.7.2/lib/elixir/lib/exception.ex#L542" class="view-source" rel="help" title="View Source">
       <span class="icon-code" aria-hidden="true"></span>
       <span class="sr-only">View Source</span>
     </a>
        
      <div class="specs">
          <pre>format_stacktrace_entry(<a href="#t:stacktrace_entry/0">stacktrace_entry</a>()) :: <a href="String.html#t:t/0">String.t</a>()</pre>
      </div>
  </div>
  <section class="docstring">
<p>Receives a stacktrace entry and formats it into a string.</p>
  </section>
</div>
<div class="detail" id="message/1">
    <div class="detail-header">
    <a href="#message/1" class="detail-link" title="Link to this function">
      <span class="icon-link" aria-hidden="true"></span>
      <span class="sr-only">Link to this function</span>
    </a>
    <span class="signature">message(exception)</span>
      <a href="https://github.com/elixir-lang/elixir/blob/v1.7.2/lib/elixir/lib/exception.ex#L56" class="view-source" rel="help" title="View Source">
       <span class="icon-code" aria-hidden="true"></span>
       <span class="sr-only">View Source</span>
     </a>
          </div>
  <section class="docstring">
<p>Gets the message for an <code class="inline">exception</code>.</p>
  </section>
</div>
<div class="detail" id="normalize/3">
  
    <span id="normalize/2"></span>
  <div class="detail-header">
    <a href="#normalize/3" class="detail-link" title="Link to this function">
      <span class="icon-link" aria-hidden="true"></span>
      <span class="sr-only">Link to this function</span>
    </a>
    <span class="signature">normalize(kind, payload, stacktrace \\ [])</span>
      <a href="https://github.com/elixir-lang/elixir/blob/v1.7.2/lib/elixir/lib/exception.ex#L92" class="view-source" rel="help" title="View Source">
       <span class="icon-code" aria-hidden="true"></span>
       <span class="sr-only">View Source</span>
     </a>
        
      <div class="specs">
          <pre>normalize(:error, <a href="typespecs.html#basic-types">any</a>(), <a href="#t:stacktrace/0">stacktrace</a>()) :: <a href="#t:t/0">t</a>()</pre>
          <pre>normalize(non_error_kind(), payload, <a href="#t:stacktrace/0">stacktrace</a>()) :: payload when payload: var</pre>
      </div>
  </div>
  <section class="docstring">
<p>Normalizes an exception, converting Erlang exceptions
to Elixir exceptions.</p>
<p>It takes the <code class="inline">kind</code> spilled by <code class="inline">catch</code> as an argument and
normalizes only <code class="inline">:error</code>, returning the untouched payload
for others.</p>
<p>The third argument is the stacktrace which is used to enrich
a normalized error with more information. It is only used when
the kind is an error.</p>
  </section>
</div>
        </section>

        <section id="callbacks" class="details-list">
          <h1 class="section-heading">
            <a class="hover-link" href="#callbacks">
              <span class="icon-link" aria-hidden="true"></span>
              <span class="sr-only">Link to this section</span>
            </a>
            Callbacks
          </h1>
<div class="detail" id="c:blame/2">
    <div class="detail-header">
    <a href="#c:blame/2" class="detail-link" title="Link to this callback">
      <span class="icon-link" aria-hidden="true"></span>
      <span class="sr-only">Link to this callback</span>
    </a>
    <span class="signature">blame(t, stacktrace)</span>
      <a href="https://github.com/elixir-lang/elixir/blob/v1.7.2/lib/elixir/lib/exception.ex#L43" class="view-source" rel="help" title="View Source">
       <span class="icon-code" aria-hidden="true"></span>
       <span class="sr-only">View Source</span>
     </a>
    
      <span class="note">(optional)</span>
    
      <div class="specs">
          <pre>blame(<a href="#t:t/0">t</a>(), <a href="#t:stacktrace/0">stacktrace</a>()) :: {<a href="#t:t/0">t</a>(), <a href="#t:stacktrace/0">stacktrace</a>()}</pre>
      </div>
  </div>
  <section class="docstring">
<p>Called from <a href="Exception.html#blame/3"><code class="inline">Exception.blame/3</code></a> to augment the exception struct.</p>
<p>Can be used to collect additional information about the exception
or do some additional expensive computation.</p>
  </section>
</div>
<div class="detail" id="c:exception/1">
    <div class="detail-header">
    <a href="#c:exception/1" class="detail-link" title="Link to this callback">
      <span class="icon-link" aria-hidden="true"></span>
      <span class="sr-only">Link to this callback</span>
    </a>
    <span class="signature">exception(term)</span>
      <a href="https://github.com/elixir-lang/elixir/blob/v1.7.2/lib/elixir/lib/exception.ex#L34" class="view-source" rel="help" title="View Source">
       <span class="icon-code" aria-hidden="true"></span>
       <span class="sr-only">View Source</span>
     </a>
        
      <div class="specs">
          <pre>exception(<a href="typespecs.html#built-in-types">term</a>()) :: <a href="#t:t/0">t</a>()</pre>
      </div>
  </div>
  <section class="docstring">
  </section>
</div>
<div class="detail" id="c:message/1">
    <div class="detail-header">
    <a href="#c:message/1" class="detail-link" title="Link to this callback">
      <span class="icon-link" aria-hidden="true"></span>
      <span class="sr-only">Link to this callback</span>
    </a>
    <span class="signature">message(t)</span>
      <a href="https://github.com/elixir-lang/elixir/blob/v1.7.2/lib/elixir/lib/exception.ex#L35" class="view-source" rel="help" title="View Source">
       <span class="icon-code" aria-hidden="true"></span>
       <span class="sr-only">View Source</span>
     </a>
        
      <div class="specs">
          <pre>message(<a href="#t:t/0">t</a>()) :: <a href="String.html#t:t/0">String.t</a>()</pre>
      </div>
  </div>
  <section class="docstring">
  </section>
</div>
        </section>
          <footer class="footer">
        <p>
          <span class="line">
            Built using
            <a href="https://github.com/elixir-lang/ex_doc" title="ExDoc" target="_blank" rel="help noopener">ExDoc</a> (v0.19.1),
          </span>
          <span class="line">
            designed by
            <a href="https://twitter.com/dignifiedquire" target="_blank" rel="noopener" title="@dignifiedquire">Friedel Ziegelmayer</a>.
            </span>
        </p>
      </footer>
    </div>
  </div>
</section>
</div>
  <script src="dist/app-a0c90688fa.js"></script>
  
  </body>
</html>