Solid Error Boundary

Learn how to wrap Solid error boundaries to automatically capture errors.

The Sentry SDK exports a function to wrap the native Solid error boundary component to automatically capture exceptions from inside a component tree and render a fallback component.

Wrap the native Solid ErrorBoundary component with Sentry.withSentryErrorBoundary.

Copied
import * as Sentry from "@sentry/solid";
import { ErrorBoundary } from "solid-js";

// Wrap Solid"s ErrorBoundary to automatically capture exceptions
const SentryErrorBoundary = Sentry.withSentryErrorBoundary(ErrorBoundary);

export default function SomeComponent() {
  return (
    <SentryErrorBoundary
      fallback={(err) => <div>Error: {err.message}</div>}
    >
      <div>Some Component</div>
    </SentryErrorBoundary>
  );
}
Help improve this content
Our documentation is open source and available on GitHub. Your contributions are welcome, whether fixing a typo (drat!) or suggesting an update ("yeah, this would be better").