Skip to content

Commit f3ba7f8

Browse files
committed
Add custom exception with breadcrumbs
1 parent 69346f3 commit f3ba7f8

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

dev.exs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,10 @@ defmodule ErrorTrackerDevWeb.PageController do
7777

7878
def call(_conn, :exception) do
7979
ErrorTracker.add_breadcrumb("ErrorTrackerDevWeb.PageController.exception")
80-
raise "This is a controller exception"
80+
81+
raise CustomException,
82+
message: "This is a controller exception",
83+
bread_crumbs: ["First", "Second"]
8184
end
8285

8386
def call(_conn, :exit) do
@@ -92,6 +95,10 @@ defmodule ErrorTrackerDevWeb.PageController do
9295
end
9396
end
9497

98+
defmodule CustomException do
99+
defexception [:message, :bread_crumbs]
100+
end
101+
95102
defmodule ErrorTrackerDevWeb.ErrorView do
96103
def render("404.html", _assigns) do
97104
"This is a 404"

0 commit comments

Comments
 (0)