Usage

Capturing Errors

If you use the error logger and setup Plug/Phoenix then you are already done, all errors will bubble up to sentry.

Otherwise we provide a simple way to capture exceptions:

do
  ThisWillError.reall()
rescue
  my_exception ->
    Sentry.capture_exception(my_exception, [stacktrace: System.stacktrace(), extra: %{extra: information}])
end

Optional Attributes

With calls to capture_exception additional data can be supplied as a keyword list:

Sentry.capture_exception(ex, opts)
extra

Additional context for this event. Must be a mapping. Children can be any native JSON type.

extra: %{key: "value"}
level

The level of the event. Defaults to error.

level: "warning"

Sentry is aware of the following levels:

  • debug (the least serious)
  • info
  • warning
  • error
  • fatal (the most serious)
tags

Tags to index with this event. Must be a mapping of strings.

tags: %{"key" => "value"}
user

The acting user.

user: %{
    "id" => 42,
    "email" => "clever-girl"
}
event_source

The source of the event. Used by the Sentry.EventFilter behaviour.