Bastion.ErrorOverlay
Bastion.ErrorOverlay — dev-mode error overlay.
Provides:
rescue_errors/1plug — stub (no-op until HttpServer.try_call is available).router_plug/1— mounts /_bastion/debug/:session_id (returns 404 stub).render_error_page/2— renders a rich HTML 500 page for dev mode.
The crash REPL is not yet available (requires March.Repl, not yet implemented).
The debug endpoint and rich error page are hard-gated at runtime on Bastion.Dev.dev_env(): outside dev the plug answers 404 and the error page degrades to a plain 500 without exception details. You can still additionally guard the mount in your router, but production safety does not depend on it.
Typical setup in your router:
import Bastion.ErrorOverlay
conn |> ErrorOverlay.router_plug()Functions
Handle /_bastion/debug/:session_id WebSocket requests.
NOTE: Crash REPL not yet available (requires March.Repl). Returns 404 for now.
Render a 500 error page with error message.
In dev mode this is the rich overlay including the error message. In any other environment it degrades to a plain "Internal Server Error" page so exception details (paths, SQL, secrets in messages) never reach clients.
Wrap the next pipeline step in error recovery.
NOTE: Not yet implemented — returns conn unchanged until HttpServer.try_call is available.
Route plug: intercept /_bastion/debug/:id requests.
Hard-gated at runtime on Bastion.Dev.dev_env() — outside dev the endpoint answers a plain 404 (indistinguishable from a missing route) regardless of how the app mounted it, so a forgotten if dev_env?() in a router cannot expose the debug surface in production.