Skip to content

Commit 6decd44

Browse files
committed
Add breadcrumbs to dev.exs scripts.
1 parent 08ee585 commit 6decd44

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

dev.exs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,14 +71,17 @@ defmodule ErrorTrackerDevWeb.PageController do
7171
end
7272

7373
def call(conn, :noroute) do
74+
ErrorTracker.add_bread_crumb("ErrorTrackerDevWeb.PageController.no_route")
7475
raise Phoenix.Router.NoRouteError, conn: conn, router: ErrorTrackerDevWeb.Router
7576
end
7677

7778
def call(_conn, :exception) do
79+
ErrorTracker.add_bread_crumb("ErrorTrackerDevWeb.PageController.exception")
7880
raise "This is a controller exception"
7981
end
8082

8183
def call(_conn, :exit) do
84+
ErrorTracker.add_bread_crumb("ErrorTrackerDevWeb.PageController.exit")
8285
exit(:timeout)
8386
end
8487

@@ -142,10 +145,16 @@ defmodule ErrorTrackerDevWeb.Endpoint do
142145

143146
plug Plug.RequestId
144147
plug Plug.Telemetry, event_prefix: [:phoenix, :endpoint]
148+
plug :add_bread_crumb
145149
plug :maybe_exception
146150
plug :set_csp
147151
plug ErrorTrackerDevWeb.Router
148152

153+
def add_bread_crumb(conn, _) do
154+
ErrorTracker.add_bread_crumb("ErrorTrackerDevWeb.Endpoint.add_bread_crumb")
155+
conn
156+
end
157+
149158
def maybe_exception(%Plug.Conn{path_info: ["plug-exception"]}, _), do: raise("Plug exception")
150159
def maybe_exception(conn, _), do: conn
151160

0 commit comments

Comments
 (0)