@@ -79,6 +79,13 @@ defmodule ErrorTracker do
7979 Breadcrumbs can be viewed in the dashboard on the details page of an occurrence.
8080 """
8181
82+ import Ecto.Query
83+
84+ alias ErrorTracker.Error
85+ alias ErrorTracker.Occurrence
86+ alias ErrorTracker.Repo
87+ alias ErrorTracker.Telemetry
88+
8289 @ typedoc """
8390 A map containing the relevant context for a particular error.
8491 """
@@ -89,13 +96,6 @@ defmodule ErrorTracker do
8996 """
9097 @ type exception :: Exception . t ( ) | { :error , any ( ) } | { Exception . non_error_kind ( ) , any ( ) }
9198
92- import Ecto.Query
93-
94- alias ErrorTracker.Error
95- alias ErrorTracker.Occurrence
96- alias ErrorTracker.Repo
97- alias ErrorTracker.Telemetry
98-
9999 @ doc """
100100 Report an exception to be stored.
101101
@@ -154,7 +154,7 @@ defmodule ErrorTracker do
154154 appear as unresolved again.
155155 """
156156 @ spec resolve ( Error . t ( ) ) :: { :ok , Error . t ( ) } | { :error , Ecto.Changeset . t ( ) }
157- def resolve ( error = % Error { status: :unresolved } ) do
157+ def resolve ( % Error { status: :unresolved } = error ) do
158158 changeset = Ecto.Changeset . change ( error , status: :resolved )
159159
160160 with { :ok , updated_error } <- Repo . update ( changeset ) do
@@ -167,7 +167,7 @@ defmodule ErrorTracker do
167167 Marks an error as unresolved.
168168 """
169169 @ spec unresolve ( Error . t ( ) ) :: { :ok , Error . t ( ) } | { :error , Ecto.Changeset . t ( ) }
170- def unresolve ( error = % Error { status: :resolved } ) do
170+ def unresolve ( % Error { status: :resolved } = error ) do
171171 changeset = Ecto.Changeset . change ( error , status: :unresolved )
172172
173173 with { :ok , updated_error } <- Repo . update ( changeset ) do
@@ -188,7 +188,7 @@ defmodule ErrorTracker do
188188 receive notifications about.
189189 """
190190 @ spec mute ( Error . t ( ) ) :: { :ok , Error . t ( ) } | { :error , Ecto.Changeset . t ( ) }
191- def mute ( error = % Error { } ) do
191+ def mute ( % Error { } = error ) do
192192 changeset = Ecto.Changeset . change ( error , muted: true )
193193
194194 Repo . update ( changeset )
@@ -201,7 +201,7 @@ defmodule ErrorTracker do
201201 for new occurrences of this error again.
202202 """
203203 @ spec unmute ( Error . t ( ) ) :: { :ok , Error . t ( ) } | { :error , Ecto.Changeset . t ( ) }
204- def unmute ( error = % Error { } ) do
204+ def unmute ( % Error { } = error ) do
205205 changeset = Ecto.Changeset . change ( error , muted: false )
206206
207207 Repo . update ( changeset )
@@ -341,7 +341,7 @@ defmodule ErrorTracker do
341341 { :ok , { error , occurrence } } =
342342 Repo . transaction ( fn ->
343343 error =
344- ErrorTracker. Repo. with_adapter ( fn
344+ Repo . with_adapter ( fn
345345 :mysql ->
346346 Repo . insert! ( error ,
347347 on_conflict: [ set: [ status: :unresolved , last_occurrence_at: DateTime . utc_now ( ) ] ]
0 commit comments