Skip to content

Commit ed69910

Browse files
committed
Avoid showing empty stacktrace and source info on error show
1 parent 36ca702 commit ed69910

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

lib/error_tracker/web/live/show.ex

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,4 +121,7 @@ defmodule ErrorTracker.Web.Live.Show do
121121
|> limit(^num_results)
122122
|> Repo.all()
123123
end
124+
125+
defp error_has_source_info?(%Error{source_function: "-", source_line: "-"}), do: false
126+
defp error_has_source_info?(%Error{}), do: true
124127
end

lib/error_tracker/web/live/show.html.heex

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,13 @@
1919
<pre class="overflow-auto p-4 rounded-lg bg-gray-300/10 border border-gray-900"><%= @occurrence.reason %></pre>
2020
</.section>
2121

22-
<.section title="Source">
22+
<.section :if={error_has_source_info?(@error)} title="Source">
2323
<pre class="overflow-auto text-sm p-4 rounded-lg bg-gray-300/10 border border-gray-900">
2424
<%= sanitize_module(@error.source_function) %>
2525
<%= @error.source_line %></pre>
2626
</.section>
2727

28-
<.section title="Stacktrace">
28+
<.section :if={@occurrence.stacktrace.lines != []} title="Stacktrace">
2929
<div class="p-4 bg-gray-300/10 border border-gray-900 rounded-lg">
3030
<div class="w-full mb-4">
3131
<label class="flex justify-end">

0 commit comments

Comments
 (0)