ForzaElixir / rollbax

Exception tracking and logging from Elixir to Rollbar
https://hexdocs.pm/rollbax
ISC License
243 stars 52 forks source link

Best way to filter/ignore errors #97

Closed philippneugebauer closed 6 years ago

philippneugebauer commented 6 years ago

I'm getting a lot of requests with no route found for mysql/admin.

What do you think is the best option to implement the ignore behavior? Maybe it is a good idea to be able to ignore errors by config?

ericmj commented 6 years ago

I have the following piece of code to filter all non-500 errors from reporting:

defp handle_errors(conn, %{kind: kind, reason: reason, stack: stacktrace}) do
  if report?(kind, reason) do
    # ...
  end
end

defp report?(:error, exception), do: Plug.Exception.status(exception) == 500
defp report?(_kind, _reason), do: true
whatyouhide commented 6 years ago

Since you handle the logic of reporting errors to Rollbar through Rollbax directly, you're responsible for any filtering and such. The example code @ericmj is very valid though, so I'd probably do something like that :).