Airbrake.report

You're seeing just the function report, go back to Airbrake module for more information.
Link to this function

report(exception, options \\ [])

Specs

report(Exception.t() | [type: String.t(), message: String.t()], Keyword.t()) ::
  :ok

Send a report to Airbrake about given exception.

exception could be Exception.t or a keywords list with two keys :type & :message

options is a keywords list with following keys:

  • :params - use it to pass request params
  • :context - use it to pass detailed information about the exceptional situation
  • :session - use it to pass info about user session
  • :env - use it to pass environment variables, headers and so on
  • :stacktrace - use it when you would like send something different than System.stacktrace

This function will always return :ok right away and perform the reporting of the given exception in the background.

Examples

Exceptions can be reported directly:

Airbrake.report(ArgumentError.exception("oops"))
#=> :ok

Often, you'll want to report something you either rescued or caught.

For rescued exceptions:

try do
  raise ArgumentError, "oops"
rescue
  exception ->
    Airbrake.report(exception)
    # You can also reraise the exception here with reraise/2
end

For caught exceptions:

try do
  throw(:oops)
  # or exit(:oops)
catch
  kind, value ->
    Airbrake.report([type: kind, message: inspect(value)])
end

Using custom data:

Airbrake.report(
  [type: "DebugInfo", message: "Something went wrong"],
  context: %{
    moon_phase: "eclipse"
  })