This page was printed on Dec 12, 2019. For the current version, visit https://help.shopify.com/en/api/embedded-apps/app-bridge/actions/error.
You can subscribe to runtime errors similar to other action types. Error actions might occur asynchronously after actions are dispatched, so it’s a good idea to subscribe to app errors. Errors will be thrown in the console if there isn't an error handler defined.
Create an app and import the Error module from @shopify/app-bridge/actions. Note that we'll be referring to this sample application throughout the examples below.
Subscribe to all errors through the app
Call the app.error method to subscribe to all errors including those that are caused by actions. Calling app.error returns a method that you can call to unsubscribe from all errors:
Subscribe to specific errors
You can call app.subscribe with a specific error type to subscribe only to that error type:
Subscribe to all errors for an action set
Call the error method on any action set to subscribe to all errors that are related to that action set: