I want to explicitly render the default debug page of Phoenix.Router.NoRouteError with stacktrace when a certain environment variable is not set and user tries to illegally access a route (/exampleroute).
When an environment variable is not set, in dev environment I want to display the debug stack trace page.
When it happens in prod, I want to display the JSON response {"errors":{"detail":"Not Found"}}
.
But when the environment variable is set in both environments, I am using plug controller which allows the user to access the route (/exampleroute) succesfully.
raise Phoenix.Router.NoRouteError, conn: conn, router: MyProjectWeb.router, plug_Status: 404
This is not working from controller plug in dev environment as I am only getting {"errors":{"detail":"Internal Server Error"}}
and no stacktrace is getting displayed.
P.S: The debug page is getting correctly displayed for any other unspecified routes.