File tree Expand file tree Collapse file tree 2 files changed +6
-4
lines changed
Expand file tree Collapse file tree 2 files changed +6
-4
lines changed Original file line number Diff line number Diff line change @@ -111,11 +111,13 @@ defmodule Sentry do
111111 @ doc """
112112 Parses and submits an exception to Sentry if current environment is in included_environments.
113113 """
114- @ spec capture_exception ( Exception . t , Keyword . t ) :: { :ok , String . t } | :error
114+ @ spec capture_exception ( Exception . t , Keyword . t ) :: { :ok , String . t } | :error | :excluded
115115 def capture_exception ( exception , opts \\ [ ] ) do
116116 filter_module = Application . get_env ( :sentry , :filter , Sentry.DefaultEventFilter )
117117 { source , opts } = Keyword . pop ( opts , :event_source )
118- unless ( filter_module . exclude_exception? ( exception , source ) ) do
118+ if ( filter_module . exclude_exception? ( exception , source ) ) do
119+ :excluded
120+ else
119121 Event . transform_exception ( exception , opts )
120122 |> send_event ( )
121123 end
Original file line number Diff line number Diff line change @@ -18,7 +18,7 @@ defmodule SentryTest do
1818 Application . put_env ( :sentry , :included_environments , [ :test ] )
1919 Application . put_env ( :sentry , :environment_name , :test )
2020
21- Sentry . capture_exception ( % RuntimeError { message: "error" } , [ event_source: :plug ] )
22- Sentry . capture_exception ( % ArithmeticError { message: "error" } , [ event_source: :plug ] )
21+ assert { :ok , _ } = Sentry . capture_exception ( % RuntimeError { message: "error" } , [ event_source: :plug ] )
22+ assert :excluded = Sentry . capture_exception ( % ArithmeticError { message: "error" } , [ event_source: :plug ] )
2323 end
2424end
You can’t perform that action at this time.
0 commit comments