Skip to main content

Ensuring POS UI extension stability by hardening callback handling

Starting with POS 10.19.0, unhandled errors in extension callbacks trigger an error page instead of failing silently. This change ensures a more stable and predictable experience for merchants and helps developers identify issues proactively.

To prevent disruptions for merchants and minimize unexpected failures, developers should thoroughly test callbacks and ensure all exceptions are properly handled.

For example, this code will now trigger an error page:

// Before: Errors occur but do not display an error page.
// POS 10.19.0 onwards: Displays an error page upon encountering an error.
<Screen
  name="example"
  title="Example"
  onReceiveParams={(params) => mayNotExist(params)}
></Screen>

One solution is to wrap the logic in try/catch blocks:

<Screen
  name="example"
  title="Example"
  onReceiveParams={(params) => {
    try {
      mayNotExist(params);
    } catch (error) {
      // Handle errors.
    }
  }}
></Screen>
Was this section helpful?