--- title: Error handling description: You can use standard web techniques to handle errors in [customer account UI extensions](/api/customer-account-ui-extensions/) but you may need to account for how they run inside of a [Web Worker](https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API). api_version: 2025-10 api_name: customer-account-ui-extensions source_url: html: https://shopify.dev/docs/api/customer-account-ui-extensions/latest/error-handling md: https://shopify.dev/docs/api/customer-account-ui-extensions/latest/error-handling.md --- # Error handling You can use standard web techniques to handle errors in [customer account UI extensions](https://shopify.dev/api/customer-account-ui-extensions/) but you may need to account for how they run inside of a [Web Worker](https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API). *** ## Handling any error Add an `unhandledrejection` listener for promise rejections or an `error` listener for other exceptions like Javascript runtime errors or failures to load a resource. ### Examples * #### Example ##### Default ```jsx // For unhandled promise rejections self.addEventListener( 'unhandledrejection', (error) => { console.warn( 'event unhandledrejection', error, ); }, ); // For other exceptions self.addEventListener('error', (error) => { console.warn('event error', error); }); ``` ## Third party libraries You can use error reporting libraries like [Sentry](https://sentry.io/). However, they might require extra configuration because UI extensions run inside of a [Web Worker](https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API). Tip You must request [network access](https://shopify.dev/api/customer-account-ui-extensions/configuration#network-access) to transmit errors to a third party service. ## Sentry Install and initialize Sentry following their [Browser JavaScript guide](https://docs.sentry.io/platforms/javascript/). We recommend disabling the default integrations to be sure it will run within a Web Worker. You'll need to add event listeners manually. ### Examples * #### Extension.jsx ##### Default ```jsx import '@shopify/ui-extensions/preact'; import {render} from 'preact'; import * as Sentry from '@sentry/browser'; Sentry.init({ dsn: 'https://examplePublicKey@o0.ingest.sentry.io/0', defaultIntegrations: false, }); self.addEventListener( 'unhandledrejection', (error) => { Sentry.captureException(error); }, ); self.addEventListener('error', (error) => { Sentry.captureException(error); }); // Your normal extension code. export default async () => { render(, document.body); }; function Extension() { return Your extension; } ```