Add steps info to applyState error message

This helps to debug/diagnose problems with state application faster.

Change-type: patch
Signed-off-by: Roman Mazur <roman@balena.io>
This commit is contained in:
Roman Mazur 2019-12-11 20:41:04 +02:00
parent 023af863d2
commit 4895bb300a
No known key found for this signature in database
GPG Key ID: 9459886EFE6EE2F6

View File

@ -440,6 +440,9 @@ module.exports = class DeviceState extends EventEmitter
.delay(nextDelay)
.then =>
@applyTarget({ force, initial, intermediate, skipLock, nextDelay, retryCount })
.catch (err) =>
detailedError = new Error('Failed to apply state transition steps. ' + err.message + ' Steps:' + JSON.stringify(_.map(steps, 'action')))
@applyError(detailedError, { force, initial, intermediate })
.catch (err) =>
@applyError(err, { force, initial, intermediate })