diff --git a/src/containers/connection-modal.jsx b/src/containers/connection-modal.jsx index 15653c7c6d13981d897027150225dcea4b837812..857ffd1911349daddcd4ce557d6e5b72200cdb76 100644 --- a/src/containers/connection-modal.jsx +++ b/src/containers/connection-modal.jsx @@ -10,7 +10,8 @@ class ConnectionModal extends React.Component { bindAll(this, [ 'handleAbortConnecting', 'handleConnected', - 'handleConnecting' + 'handleConnecting', + 'handleError' ]); this.state = { phase: 'scanning' @@ -18,9 +19,11 @@ class ConnectionModal extends React.Component { } componentDidMount () { this.props.vm.on('PERIPHERAL_CONNECTED', this.handleConnected); + this.props.vm.on('PERIPHERAL_ERROR', this.handleError); } componentWillUnmount () { this.props.vm.removeListener('PERIPHERAL_CONNECTED', this.handleConnected); + this.props.vm.removeListener('PERIPHERAL_ERROR', this.handleError); } handleConnecting (peripheralId) { this.props.vm.connectToPeripheral(this.props.extensionId, peripheralId); @@ -28,6 +31,11 @@ class ConnectionModal extends React.Component { phase: 'connecting' }); } + handleError () { + this.setState({ + phase: 'error' + }); + } handleAbortConnecting () { // @todo: abort the current device connection process in the VM this.setState({