Skip to content

Error Handling

Browser Lifecycle surfaces failures through typed errors and events.

Typed errors

ErrorWhen it throws
ConfigurationErrorInvalid or incompatible configuration
LifecycleErrorInvalid start, stop, or dispose transitions
InitializationErrorModule startup failure
PluginErrorPlugin hook failure
UnsupportedFeatureErrorRequired capability unavailable
ModuleRegistryErrorInternal module registration conflict

Plugin errors

Listen for plugin failures without crashing the session:

ts
lifecycle.on("plugin:error", (event) => {
  console.error(event.metadata.pluginId, event.metadata.error);
});

Listener errors

Typed event infrastructure isolates listener failures. Use the Event Explorer to confirm delivery order when debugging.

Production recommendations

  • Log configuration validation failures before creating a session
  • Treat dispose() as mandatory cleanup
  • Surface plugin errors to observability tooling
  • Avoid swallowing LifecycleError without fixing the transition sequence

JOC is a JayOnCode monorepo of @jayoncode/* packages. Docs sync from source via TypeDoc and sync scripts.