Skip to content

Commit 1d39f46

Browse files
tjarrattkrishna1m
andcommitted
Add example of ignoring a specific type of error
Closes: 153 Co-authored-by: Manmohan Krishna <[email protected]>
1 parent 99c3fb2 commit 1d39f46

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

guides/Getting Started.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,19 @@ The `ErrorTracker.Ignorer` behaviour allows you to ignore errors based on their
163163

164164
When an error is ignored, its occurrences are not tracked at all. This is useful for expected errors that you don't want to store in your database.
165165

166+
For example, if you had an integration with an unreliable third-party system that was frequently timing out, you could ignore those errors like so:
167+
168+
```elixir
169+
defmodule MyApp.ErrorIgnores do
170+
@behaviour ErrorTracker.Ignorer
171+
172+
@impl ErrorTracker.Ignorer
173+
def ignore?(%{kind: "Elixir.UnreliableThirdParty.Error", reason: ":timeout"} = _error, _context) do
174+
true
175+
end
176+
end
177+
```
178+
166179
### Muting Errors
167180

168181
Sometimes you may want to keep tracking error occurrences but avoid receiving notifications about them. For these cases,

0 commit comments

Comments
 (0)