1
0
Fork 0
mirror of https://github.com/openstf/stf synced 2025-10-04 18:29:17 +02:00

No need to log errors when we get a valid error code for installation failure. But it's still interesting so let's log it at a lower level.

This commit is contained in:
Simo Kinnunen 2014-09-04 12:05:19 +09:00
parent f4d0071cc4
commit e5983d5271

View file

@ -11,6 +11,13 @@ var wire = require('../../../wire')
var wireutil = require('../../../wire/util') var wireutil = require('../../../wire/util')
var promiseutil = require('../../../util/promiseutil') var promiseutil = require('../../../util/promiseutil')
// The error codes are available at https://github.com/android/
// platform_frameworks_base/blob/master/core/java/android/content/
// pm/PackageManager.java
function InstallationError(err) {
return err.code && /^INSTALL_/.test(err.code)
}
module.exports = syrup.serial() module.exports = syrup.serial()
.dependency(require('../support/adb')) .dependency(require('../support/adb'))
.dependency(require('../support/router')) .dependency(require('../support/router'))
@ -164,15 +171,22 @@ module.exports = syrup.serial()
, reply.fail('timeout') , reply.fail('timeout')
]) ])
}) })
.catch(function(err) { .catch(InstallationError, function(err) {
log.error('Installation of package "%s" failed', pkg, err.stack) log.important(
// The error codes are available at https://github.com/android/ 'Tried to install package "%s", got "%s"'
// platform_frameworks_base/blob/master/core/java/android/content/ , pkg
// pm/PackageManager.java, although this could be some other , err.code
// error as well. )
push.send([ push.send([
channel channel
, reply.fail(err.code || 'fail') , reply.fail(err.code)
])
})
.catch(function(err) {
log.error('Installation of package "%s" failed', pkg, err.stack)
push.send([
channel
, reply.fail('fail')
]) ])
}) })
}) })