[]previous and next page

Common mistakes

Common mistakes in the Error handling guide.

For agentsUpdated
  • Expecting an ErrorBoundary to catch event handler errors or rejected promises. It only sees errors raised inside its owner tree. Catch in the handler and write to a signal, or call handleError(error, owner).
  • One boundary for the whole app. A failure then replaces everything. Put boundaries around independent regions: a widget, a route, a list.
  • Throwing in a fallback. The error leaves the boundary. Keep fallbacks free of code that can throw, or make sure an outer boundary exists.
  • Matching on error.message. Dev and production messages differ. Use error.code.
  • Ignoring an errored resource nobody reads. It stays silent. Read it where it should fail, or check data.error.
  • Calling reset without removing the cause. The children are rebuilt and fail again; the fallback comes back.
  • onError after an await. There is no owner, so it warns NO_OWNER_ERROR. Register handlers during setup.