diff --git a/src/driver/connect.ts b/src/driver/connect.ts index 45efd25..18b90ba 100644 --- a/src/driver/connect.ts +++ b/src/driver/connect.ts @@ -1,6 +1,5 @@ import * as React from 'react' - -type x = [] extends any[] ? [] : any[] +import { raiseError } from 'analytics' export type Method = ( ...args: Args extends any[] ? Args : any[] @@ -82,8 +81,12 @@ function link(instance: React.Component, sources: Sources): Wr const dispatchState: DispatchState = (updater, callback) => { instance.setState(updater, callback) } - const prepareState: PreDispatch = updater => { - updater(instance.state, instance.props) + const prepareState: PreDispatch = async updater => { + try { + await updater(instance.state, instance.props) + } catch (error) { + raiseError(error) + } } const dispatch: Dispatch = { call: dispatchCall,