View Source AirbrakeEx (airbrake_ex v0.2.6)

This module provides functions to report any kind of exception to Airbrake.

Configuration

The project_key and project_id parameters must be set in your application environment, usually defined in your config/config.exs or, if you are setting them with environment variables, then wherever you do that (config/runtime.exs, rel/config.exs, etc). logger_level and environment are optional. To use an Errbit instance rather than Airbrake, set :endpoint to your custom url.

config :airbrake_ex,
  project_key: "abcdef12345",
  project_id: 123456,
  logger_level: :error,
  environment: Mix.env,
  endpoint: "http://errbit.yourdomain.com"

Usage

try do
  IO.inspect("test",[],"")
rescue
  exception -> AirbrakeEx.notify(exception, __STACKTRACE__)
end

You can ignore certain types of errors by specifying the :ignore config key:

config :airbrake_ex,
  ...
  # List form
  ignore: [Phoenix.Router.NoRouteError]
  # OR
  # Function
  ignore: fn(error) ->
    cond do
      error.type == Phoenix.Router.NoRouteError -> true
      String.contains?(error.message, "Ecto.NoResultsError") -> true
      true -> false
    end
  end

Summary

Functions

Notify airbrake about a new exception

Functions

Link to this function

notify(exception, stacktrace \\ [], options \\ [])

View Source

Notify airbrake about a new exception

Parameters

  • exception: Exception to notify
  • stacktrace: the STACKTRACE from the catch/rescue block
  • options: Options

Options

Options that are sent to airbrake with exceptions:

  • context
  • session
  • params
  • environment