docs / when it breaks
When it breaks
Every error ruact raises that you can meet in an app, by the moment it stops you — the message as it reads, what set it off, and the fix.
ruact 0.0.22
When you finish
- where each kind of ruact error surfaces: a page, a log line, a boot failure, a boundary
- the page that has your message, its cause and its fix
ruact’s errors are written to be read: most name the component, the file and the line, and say what to change. These pages collect them so you can find yours by searching for a few words of it, and read what is around it.
The messages are the gem’s own text. On In the template they were produced by running ruact 0.0.22’s ERB preprocessor on the template shown; elsewhere they are the gem’s message templates with example names filled in, and a value the gem fills from your app is shown in angle brackets, like <path>.
Where an error surfaces
Section titled “Where an error surfaces”| You see | When | Pages |
|---|---|---|
An ActionView::Template::Error page |
ruact compiles a template: a component tag, its attributes, a <Suspense> |
In the template |
| An error page while a page renders | the template compiled, and rendering it went wrong | While a page renders, Props that cannot cross |
An error row where a <Suspense> boundary was, and a [ruact] log line |
anything raised inside a <Suspense> block |
the page for the error itself |
| The app does not boot, or a rake task exits 1 | configuration, controller macros, routes, server-function names | Configuration and boot |
| An HTTP 400 or 413 with a JSON body | a server function or a useQuery call from React |
Server functions and queries |
A ✗ or ⚠ line from rails ruact:doctor |
the health check | rails ruact:doctor |
An error inside a <Suspense> block does not take the page down. The rest of the page renders. In that boundary’s place React shows <error class>: <message> in development and An error occurred in a <Suspense> in production, and the log has the full line:
[ruact] <Suspense> content at <app root>/app/views/posts/index.html.erb:12 raised: ActiveRecord::RecordNotFound: Couldn't find Post with 'id'=999Try one
Section titled “Try one”The home page’s editor, Break it on purpose, raises the first message on In the template when you misspell the component — the gem’s text, pinned byte for byte by spec/readme_demo_message_spec.rb.