mirror of
https://github.com/DeviceFarmer/stf.git
synced 2026-04-19 00:23:25 +02:00
Fix error-catch problem and some refactoring.
This commit is contained in:
@@ -49,7 +49,7 @@ module.exports = syrup.serial()
|
||||
, reply.okay()
|
||||
])
|
||||
})
|
||||
.error(function(err) {
|
||||
.catch(function(err) {
|
||||
log.error('Account removal failed', err.stack)
|
||||
push.send([
|
||||
channel
|
||||
@@ -71,7 +71,7 @@ module.exports = syrup.serial()
|
||||
, reply.okay()
|
||||
])
|
||||
})
|
||||
.error(function(err) {
|
||||
.catch(function(err) {
|
||||
log.error('Add account menu failed', err.stack)
|
||||
push.send([
|
||||
channel
|
||||
|
||||
@@ -22,7 +22,7 @@ module.exports = syrup.serial()
|
||||
, reply.okay(mounted ? 'sd_mounted' : 'sd_unmounted')
|
||||
])
|
||||
})
|
||||
.error(function(err) {
|
||||
.catch(function(err) {
|
||||
log.error('Getting SD card Status', err.stack)
|
||||
push.send([
|
||||
channel
|
||||
|
||||
@@ -507,20 +507,20 @@ module.exports = syrup.serial()
|
||||
|
||||
plugin.removeAccount = function(data) {
|
||||
return runServiceCommand(
|
||||
apk.wire.MessageType.DO_REMOVE_ACCOUNT
|
||||
, new apk.wire.DoRemoveAccountRequest({
|
||||
type: data.type
|
||||
, account: data.account
|
||||
})
|
||||
)
|
||||
.timeout(15000)
|
||||
.then(function(data) {
|
||||
var response = apk.wire.DoRemoveAccountResponse.decode(data)
|
||||
if (response.success) {
|
||||
return true
|
||||
}
|
||||
throw new Error('Unable to remove account')
|
||||
apk.wire.MessageType.DO_REMOVE_ACCOUNT
|
||||
, new apk.wire.DoRemoveAccountRequest({
|
||||
type: data.type
|
||||
, account: data.account
|
||||
})
|
||||
)
|
||||
.timeout(15000)
|
||||
.then(function(data) {
|
||||
var response = apk.wire.DoRemoveAccountResponse.decode(data)
|
||||
if (response.success) {
|
||||
return true
|
||||
}
|
||||
throw new Error('Unable to remove account')
|
||||
})
|
||||
}
|
||||
|
||||
plugin.addAccountMenu = function() {
|
||||
|
||||
@@ -22,7 +22,7 @@ module.exports = syrup.serial()
|
||||
, reply.okay()
|
||||
])
|
||||
})
|
||||
.error(function(err) {
|
||||
.catch(function(err) {
|
||||
log.error('Setting Wifi enabled failed', err.stack)
|
||||
push.send([
|
||||
channel
|
||||
@@ -42,7 +42,7 @@ module.exports = syrup.serial()
|
||||
, reply.okay(enabled ? 'wifi_enabled' : 'wifi_disabled')
|
||||
])
|
||||
})
|
||||
.error(function(err) {
|
||||
.catch(function(err) {
|
||||
log.error('Getting Wifi status failed', err.stack)
|
||||
push.send([
|
||||
channel
|
||||
|
||||
Reference in New Issue
Block a user