I’m exploring ways to embed underthehood into the debugging page used when debug_errors: true
is set on the endpoint. This package provides a LiveView component presenting a fully-functional Iex session into the VM, enabling people to go spelunking around their application code in case anything goes wrong. I suspect this might come in handy when debugging.
To avoid pulling in unnecessary dependencies, my plan was to first contribute a PR which adjusts Phoenix.Endpoint.RenderErrors.__debug_banner__/5
such that it somehow considers “hooks” (e.g. a list of MFA tuples) provided via the configuration when rendering markup. Any hooks would then get invoked, contributing additional markup.
I could then go ahead and create a phoenix_live_debug_terminal
package or the like which depends on underthehood
and implements a hook embedding the terminal component into the error page. Users would get the interactive shell (and a LiveView dependency) simply by depending on phoenix_live_debug_terminal
and configuring their endpoint(s) like
config :my_app, MyApp.Endpoint,
debug_page_hooks: {Phoenix.LiveDebugTerminal, :render, []}
…such that when rendering the debug page, a nice little terminal is embedded.
Before going ahead, I wanted to reach out and clarify:
- Does having an interactive IEx shell in the debug view seem like a useful feature?
- Is the approach of making
Phoenix.Endpoint.RenderErrors.__debug_banner__/5
respect hooks (specified via MFA tuples) a good way about enabling users to extend the debug page?
Any feedback is much appreciated.