Skip to content

Commit

Permalink
Catch calling non-functions
Browse files Browse the repository at this point in the history
  • Loading branch information
jhnstn committed Apr 7, 2023
1 parent 9b389db commit 43ef2da
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion packages/components/src/sandbox/index.native.js
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,15 @@ const Sandbox = forwardRef( function Sandbox(
// Forward the event to parent event listeners
Object.keys( onWindowEvents ).forEach( ( eventType ) => {
if ( data?.type === eventType ) {
onWindowEvents[ eventType ]( data );
try {
onWindowEvents[ eventType ]( data );
} catch ( e ) {
// eslint-disable-next-line no-console
console.warn(
`Error handling event ${ eventType }`,
e
);
}
}
} );
},
Expand Down

0 comments on commit 43ef2da

Please sign in to comment.