@@ -118,10 +118,11 @@ defmodule ErrorTracker do
118
118
{ kind , reason } = normalize_exception ( exception , stacktrace )
119
119
{ :ok , stacktrace } = ErrorTracker.Stacktrace . new ( stacktrace )
120
120
{ :ok , error } = Error . new ( kind , reason , stacktrace )
121
- context = get_context ( ) |> Map . merge ( given_context ) |> filter_context_data ( )
121
+ context = Map . merge ( get_context ( ) , given_context )
122
122
123
123
if enabled? ( ) && ! ignored? ( error , context ) do
124
- { _error , occurrence } = upsert_error! ( error , stacktrace , context , reason )
124
+ sanitized_context = sanitize_context ( context )
125
+ { _error , occurrence } = upsert_error! ( error , stacktrace , sanitized_context , reason )
125
126
occurrence
126
127
else
127
128
:noop
@@ -209,14 +210,12 @@ defmodule ErrorTracker do
209
210
ignorer && ignorer . ignore? ( error , context )
210
211
end
211
212
212
- defp filter_context_data ( context ) do
213
+ defp sanitize_context ( context ) do
213
214
filter_mod = Application . get_env ( :error_tracker , :filter )
214
215
215
- if filter_mod do
216
- filter_mod . sanitize ( context )
217
- else
218
- context
219
- end
216
+ if filter_mod ,
217
+ do: filter_mod . sanitize ( context ) ,
218
+ else: context
220
219
end
221
220
222
221
defp normalize_exception ( % struct { } = ex , _stacktrace ) when is_exception ( ex ) do
0 commit comments