Convert ErrorIgnorer tests to doctests

This commit is contained in:
Claudio Ortolina
2026-04-19 07:50:39 +01:00
parent 06ae5f8271
commit 45236e4b10
2 changed files with 24 additions and 18 deletions
+23
View File
@@ -12,6 +12,29 @@ defmodule MusicLibrary.ErrorIgnorer do
to_string(Phoenix.Router.NoRouteError)
]
@doc """
Returns `true` when the error kind should not be tracked.
## Examples
iex> MusicLibrary.ErrorIgnorer.ignore?(
...> %ErrorTracker.Error{kind: "Elixir.Phoenix.Router.NoRouteError"},
...> %{}
...> )
true
iex> MusicLibrary.ErrorIgnorer.ignore?(
...> %ErrorTracker.Error{kind: "Elixir.RuntimeError"},
...> %{}
...> )
false
iex> MusicLibrary.ErrorIgnorer.ignore?(
...> %ErrorTracker.Error{kind: "Elixir.Ecto.NoResultsError"},
...> %{}
...> )
false
"""
@impl true
def ignore?(%ErrorTracker.Error{kind: kind}, _context) when kind in @ignored_kinds, do: true
def ignore?(_error, _context), do: false