Skip to content

Commit

Permalink
feat: supports ignoring certain exceptions
Browse files Browse the repository at this point in the history
  • Loading branch information
grzuy committed Aug 2, 2024
1 parent 2088324 commit b6d4097
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions lib/tower.ex
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,10 @@ defmodule Tower do
@spec handle_exception(Exception.t(), Exception.stacktrace(), Keyword.t()) :: :ok
def handle_exception(exception, stacktrace, options \\ [])
when is_exception(exception) and is_list(stacktrace) do
Event.from_exception(exception, stacktrace, options)
|> report_event()
unless exception.__struct__ in ignored_exceptions() do
Event.from_exception(exception, stacktrace, options)
|> report_event()
end
end

@spec handle_throw(term(), Exception.stacktrace()) :: :ok
Expand Down Expand Up @@ -77,4 +79,9 @@ defmodule Tower do
Tower.TaskSupervisor
|> Task.Supervisor.start_child(fun)
end

defp ignored_exceptions do
# TODO: Make it configurable
[ExUnit.AssertionError]
end
end

0 comments on commit b6d4097

Please sign in to comment.