Phoenix.Controller.Exception

Formats Plug exceptions and handles Error logging

Logging from Error controllers

defmodule MyErrorController do
  ...
  def error(conn, _) do
    Phoenix.Controller.Exception.log(conn)
    render conn, "pretty_error_page"
  end

end

Summary

from_conn(conn)

Returns Exception struct from caught conn exception or :no_exception

log(exception)

Logs the caught conn exception as an error

Functions

from_conn(conn)

Returns Exception struct from caught conn exception or :no_exception

Examples

iex> Exception.from_conn(conn)
%Exception{...}

iex> Exception.from_conn(conn)
:no_exception
log(exception)

Logs the caught conn exception as an error

Examples

iex> Exception.log(conn)

iex> exeption = Exception.from_conn(conn)
iex> Exception.log(exception)