We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 9b5a40d commit fc5709dCopy full SHA for fc5709d
1 file changed
lib/error_tracker.ex
@@ -1,24 +1,20 @@
1
defmodule ErrorTracker do
2
- alias ErrorTracker.Repo
3
-
4
def report(exception, stacktrace, context \\ %{}) do
5
{:ok, stacktrace} = ErrorTracker.Stacktrace.new(stacktrace)
6
{:ok, error} = ErrorTracker.Error.new(exception, stacktrace)
7
8
error =
9
- Repo.insert!(error,
+ repo().insert!(error,
10
on_conflict: [set: [status: :unresolved]],
11
conflict_target: :fingerprint
12
)
13
14
error
15
|> Ecto.build_assoc(:occurrences, stacktrace: stacktrace, context: context)
16
- |> Repo.insert!()
+ |> repo().insert!()
17
end
18
19
- def raise do
20
- raise "PROBANDO PROBANDO"
21
- rescue
22
- e -> report(e, __STACKTRACE__)
+ def repo do
+ Application.fetch_env!(:error_tracker, :repo)
23
24
0 commit comments