Module: Ruact::ServerFunctions::ErrorRendering

Included in:
Ruact::Server, EndpointController
Defined in:
lib/ruact/server_functions/error_rendering.rb

Overview

Story 9.1 — the shared salvage core for the Story 8.4 structured-error rendering and the Story 8.5 upload guard. Extracted from EndpointController so the SAME implementation serves both homes during the strangler-fig transition:

- {EndpointController} (v1 — synthetic `POST /__ruact/fn/:name`
  endpoint; removed by Story 9.9)
- {Ruact::Server} (v2 — the route-driven concern hosts include)

Keeping one source guarantees the 8.4/8.5 wire contract is byte-for-byte identical across both homes by construction; behavioral differences are expressed exclusively through the three private hooks below, which each home may override:

- {#__ruact_error_action_name} — where the payload's `action_name`
  comes from. Default: the controller's own `action_name` (correct for
  v2 host controllers). The v1 endpoint overrides it with its
  registry-symbol / `path_parameters[:name]` fallback chain.
- {#__ruact_render_structured_error?} — whether the rescue handler
  renders the structured JSON payload for this request, or re-raises so
  Rails' default error handling proceeds. Default: always render
  (v1 endpoint semantics — every request there is a function call).
  {Ruact::Server} gates this on the function-call predicate.
- {#__ruact_upload_guard_applicable?} — whether the upload guard
  applies to this request at all. Default: always (the v1 endpoint is
  POST-only). {Ruact::Server} skips GET/HEAD so page actions stay
  byte-for-byte untouched.

All methods are private on the including controller; nothing here is public API surface.