From 1d39f465b97c77bd882c0d3b0b5f0c9e520c7d9e Mon Sep 17 00:00:00 2001 From: Tim Jarratt Date: Fri, 9 May 2025 14:03:17 +0200 Subject: [PATCH 1/4] Add example of ignoring a specific type of error Closes: 153 Co-authored-by: Manmohan Krishna --- guides/Getting Started.md | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/guides/Getting Started.md b/guides/Getting Started.md index d94c3bc..a1bcd8f 100644 --- a/guides/Getting Started.md +++ b/guides/Getting Started.md @@ -163,6 +163,19 @@ The `ErrorTracker.Ignorer` behaviour allows you to ignore errors based on their 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. +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: + +```elixir +defmodule MyApp.ErrorIgnores do + @behaviour ErrorTracker.Ignorer + + @impl ErrorTracker.Ignorer + def ignore?(%{kind: "Elixir.UnreliableThirdParty.Error", reason: ":timeout"} = _error, _context) do + true + end +end +``` + ### Muting Errors Sometimes you may want to keep tracking error occurrences but avoid receiving notifications about them. For these cases, From f1105bd200da673b110525cac063003539cc1ecf Mon Sep 17 00:00:00 2001 From: Tim Jarratt Date: Fri, 9 May 2025 14:05:00 +0200 Subject: [PATCH 2/4] Provide more accurate type for ErrorTracker.Error Co-authored-by: Manmohan Krishna --- lib/error_tracker/schemas/error.ex | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/lib/error_tracker/schemas/error.ex b/lib/error_tracker/schemas/error.ex index d2d8d4c..69fa969 100644 --- a/lib/error_tracker/schemas/error.ex +++ b/lib/error_tracker/schemas/error.ex @@ -12,7 +12,13 @@ defmodule ErrorTracker.Error do use Ecto.Schema - @type t :: %__MODULE__{} + @type t :: %__MODULE__{ + kind: string(), + reason: string(), + source_line: string(), + source_function: string(), + status: :resolved | :unresolved + } schema "error_tracker_errors" do field :kind, :string From cf3c37ec63ae2d7bfd5b0a95126cd7d93815e8d6 Mon Sep 17 00:00:00 2001 From: Tim Jarratt Date: Mon, 12 May 2025 15:09:48 +0200 Subject: [PATCH 3/4] Prefer String.t() over string() --- lib/error_tracker/schemas/error.ex | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/error_tracker/schemas/error.ex b/lib/error_tracker/schemas/error.ex index 69fa969..95d4773 100644 --- a/lib/error_tracker/schemas/error.ex +++ b/lib/error_tracker/schemas/error.ex @@ -13,12 +13,12 @@ defmodule ErrorTracker.Error do use Ecto.Schema @type t :: %__MODULE__{ - kind: string(), - reason: string(), - source_line: string(), - source_function: string(), - status: :resolved | :unresolved - } + kind: String.t(), + reason: String.t(), + source_line: String.t(), + source_function: String.t(), + status: :resolved | :unresolved + } schema "error_tracker_errors" do field :kind, :string From fc6905dc382ece7201ab5599d5dd511e29371ac4 Mon Sep 17 00:00:00 2001 From: Tim Jarratt Date: Mon, 12 May 2025 15:11:05 +0200 Subject: [PATCH 4/4] Document additional fields for errors --- lib/error_tracker/schemas/error.ex | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/error_tracker/schemas/error.ex b/lib/error_tracker/schemas/error.ex index 95d4773..643332b 100644 --- a/lib/error_tracker/schemas/error.ex +++ b/lib/error_tracker/schemas/error.ex @@ -17,7 +17,10 @@ defmodule ErrorTracker.Error do reason: String.t(), source_line: String.t(), source_function: String.t(), - status: :resolved | :unresolved + status: :resolved | :unresolved, + fingerprint: String.t(), + last_occurrence_at: DateTime.t(), + muted: boolean() } schema "error_tracker_errors" do