Module: Ruact::ServerFunctions::ErrorSuggestion
- Defined in:
- lib/ruact/server_functions/error_suggestion.rb
Overview
Story 8.4 — Maps an exception class (by its String name) to a short corrective suggestion shown in the dev overlay’s structured view.
The class-name match runs against ‘error.class.name` (a String) so the module does NOT need `require “active_record”` or `require “action_controller”` to operate; it works in AR-less specs and bare-Rack hosts (see Pitfall #4 in the story).
The SUGGESTIONS table is a gem-published surface — new entries land via an ADR amendment + a constant update, NOT via runtime registration.
Constant Summary collapse
- SUGGESTIONS =
{ "ActiveRecord::RecordInvalid" => "Validation failed — check the model's `validates` rules", "ActionController::InvalidAuthenticityToken" => "CSRF token mismatch — ensure the page was rendered after the most recent server restart and the session cookie is intact", # Story 8.5 — multipart-upload reject. Routes devs to either the # config knob (for "raise the limit by a few MB") or the streaming # upload pipelines (for "this should never have been a server-action # request in the first place"). "Ruact::UploadTooLargeError" => "Upload exceeded the configured size limit. Increase Ruact.config.max_upload_bytes or use Active Storage Direct Upload / a presigned S3 URL for large files." }.freeze
Class Method Summary collapse
-
.for(error) ⇒ String?
Suggestion string for the given error, or nil for unknown classes.
Class Method Details
.for(error) ⇒ String?
Suggestion string for the given error, or nil for unknown classes.
33 34 35 |
# File 'lib/ruact/server_functions/error_suggestion.rb', line 33 def self.for(error) SUGGESTIONS[error.class.name] end |