Merge pull request #2491 from resin-io/warn-if-cant-require-usb

fix(GUI): Warn when requiring usb fails
This commit is contained in:
Lorenzo Alberto Maria Ambrosi 2018-10-02 17:23:35 +02:00 committed by GitHub
commit 4035176d88
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -18,6 +18,7 @@
const _ = require('lodash')
const Bluebird = require('bluebird')
const analytics = require('../../../gui/app/modules/analytics')
// The USB module calls `libusb_init`, which will fail
// if the device we're running in has no USB controller
@ -28,6 +29,7 @@ const usb = (() => {
try {
return require('usb')
} catch (error) {
analytics.logException(error)
return {
getDeviceList: _.constant([])
}