Skip to content

Commit 37d51b6

Browse files
committed
Store source file and source fun separately
1 parent ecd1932 commit 37d51b6

2 files changed

Lines changed: 6 additions & 3 deletions

File tree

dev.exs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,8 @@ defmodule Migration0 do
116116
create table(:error_tracker_errors) do
117117
add :kind, :string, null: false
118118
add :reason, :text, null: false
119-
add :source, :text, null: false
119+
add :source_line, :text, null: false
120+
add :source_function, :text, null: false
120121
add :status, :string, null: false
121122
add :fingerprint, :string, null: false
122123

lib/error_tracker/models/error.ex

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@ defmodule ErrorTracker.Error do
44
schema "error_tracker_errors" do
55
field :kind, :string
66
field :reason, :string
7-
field :source, :string
7+
field :source_line, :string
8+
field :source_function, :string
89
field :status, Ecto.Enum, values: [:resolved, :unresolved], default: :unresolved
910
field :fingerprint, :binary
1011

@@ -19,7 +20,8 @@ defmodule ErrorTracker.Error do
1920
params = [
2021
kind: "error",
2122
reason: Exception.message(exception),
22-
source: to_string(source)
23+
source_line: "#{source.file}:#{source.line}",
24+
source_function: "#{source.module}.#{source.function}/#{source.arity}"
2325
]
2426

2527
fingerprint = :crypto.hash(:sha256, params |> Keyword.values() |> Enum.join())

0 commit comments

Comments
 (0)