-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
85 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,7 @@ | ||
defmodule Tower.PhoenixApp.Endpoint do | ||
use Phoenix.Endpoint, otp_app: :phoenix_app | ||
|
||
plug(Tower.TestPlug) | ||
# So that it fetches query params | ||
plug(Plug.Parsers, parsers: []) | ||
plug(Tower.PhoenixApp.Router) | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
defmodule Tower.PhoenixApp.ErrorHTML do | ||
def render("500.html", _assigns) do | ||
"Internal Server Error" | ||
def render(template, _assigns) do | ||
Phoenix.Controller.status_message_from_template(template) | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
defmodule Tower.PhoenixApp.HomeController do | ||
use Phoenix.Controller, formats: [:html], put_default_views: false | ||
|
||
def show(conn, %{"param" => "valid"}) do | ||
Plug.Conn.send_resp(conn, 200, "Hey!") | ||
end | ||
|
||
def runtime_error(conn, _params) do | ||
raise "an error" | ||
|
||
Plug.Conn.send_resp(conn, 200, "OK") | ||
end | ||
|
||
def abnormal_exit(conn, _params) do | ||
exit(:abnormal) | ||
|
||
Plug.Conn.send_resp(conn, 200, "OK") | ||
end | ||
|
||
def uncaught_throw(conn, _params) do | ||
throw("something") | ||
|
||
Plug.Conn.send_resp(conn, 200, "OK") | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
defmodule Tower.PhoenixApp.Router do | ||
use Phoenix.Router, helpers: false | ||
|
||
get("/runtime-error", Tower.PhoenixApp.HomeController, :runtime_error) | ||
get("/abnormal-exit", Tower.PhoenixApp.HomeController, :abnormal_exit) | ||
get("/uncaught-throw", Tower.PhoenixApp.HomeController, :uncaught_throw) | ||
get("/show", Tower.PhoenixApp.HomeController, :show) | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters