Skip to Content
v1.36.0 · shipped One-screen report · Looks like your app Read the changelog →
SDK referencemushi-mushi/svelte

mushi-mushi/svelte

Mushi Mushi boot helpers for Svelte and SvelteKit over mushi-mushi. Shared wrapper notes: Framework wrappers.

npm install mushi-mushi

See Quickstart → Svelte for the short install path.

API surface

import { initMushi, getMushi, createMushiErrorHandler } from 'mushi-mushi/svelte'
ExportPurpose
initMushi(config)Boot once. Calls Mushi.init in the browser and returns null during SSR
getMushi()SDK instance after init; throws if initMushi() has not run
mushiHandleError(opts?)Returns a SvelteKit handleError hook that sends the error with captureException(); optional format maps the error to App.Error
createMushiErrorHandler()Older ({ error, event }) handler, kept for backwards compatibility. Prefer mushiHandleError

The error helpers send only when an SDK instance exists. Because initMushi() does nothing on the server, a helper used in hooks.server.ts does not send server errors; use mushi-mushi/node for those.

Setup

import { initMushi } from 'mushi-mushi/svelte' initMushi({ projectId: import.meta.env.VITE_MUSHI_PROJECT_ID, apiKey: import.meta.env.VITE_MUSHI_API_KEY, })

Call from hooks.client.ts or a top-level +layout.svelte onMount.

Submitting a report

import { getMushi } from 'mushi-mushi/svelte' const mushi = getMushi() await mushi.captureEvent({ description: 'Something feels off', category: 'bug', })
Last updated on