@@ -67,6 +67,11 @@ defmodule ErrorTracker do
6767 """
6868 @ type context :: % { String . t ( ) => any ( ) }
6969
70+ @ typedoc """
71+ An `Exception` or a `{kind, payload}` tuple compatible with `Exception.normalize/3`.
72+ """
73+ @ type exception :: Exception . t ( ) | { :error , any ( ) } | { Exception . non_error_kind ( ) , any ( ) }
74+
7075 import Ecto.Query
7176
7277 alias ErrorTracker.Error
@@ -107,6 +112,8 @@ defmodule ErrorTracker do
107112 * A `{kind, exception}` tuple in which case the information is converted to
108113 an Elixir exception (if possible) and stored.
109114 """
115+
116+ @ spec report ( exception ( ) , Exception . stacktrace ( ) , context ( ) ) :: Occurrence . t ( ) | :noop
110117 def report ( exception , stacktrace , given_context \\ % { } ) do
111118 { kind , reason } = normalize_exception ( exception , stacktrace )
112119 { :ok , stacktrace } = ErrorTracker.Stacktrace . new ( stacktrace )
@@ -127,6 +134,7 @@ defmodule ErrorTracker do
127134 If an error is marked as resolved and it happens again, it will automatically
128135 appear as unresolved again.
129136 """
137+ @ spec resolve ( Error . t ( ) ) :: { :ok , Error . t ( ) } | { :error , Ecto.Changeset . t ( ) }
130138 def resolve ( error = % Error { status: :unresolved } ) do
131139 changeset = Ecto.Changeset . change ( error , status: :resolved )
132140
@@ -139,6 +147,7 @@ defmodule ErrorTracker do
139147 @ doc """
140148 Marks an error as unresolved.
141149 """
150+ @ spec unresolve ( Error . t ( ) ) :: { :ok , Error . t ( ) } | { :error , Ecto.Changeset . t ( ) }
142151 def unresolve ( error = % Error { status: :resolved } ) do
143152 changeset = Ecto.Changeset . change ( error , status: :unresolved )
144153
0 commit comments