Common mistakes
Common mistakes in the Error handling guide.
- Expecting an
ErrorBoundaryto 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 callhandleError(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. Useerror.code. - Ignoring an
erroredresource nobody reads. It stays silent. Read it where it should fail, or checkdata.error. - Calling
resetwithout removing the cause. The children are rebuilt and fail again; the fallback comes back. onErrorafter anawait. There is no owner, so it warnsNO_OWNER_ERROR. Register handlers during setup.