Add BoxError.toPlainObject
This commit is contained in:
+6
-6
@@ -530,8 +530,7 @@ function install(app, restoreConfig, progressCallback, callback) {
|
||||
], function seriesDone(error) {
|
||||
if (error) {
|
||||
debugApp(app, 'error installing app: %s', error);
|
||||
const appError = _.extend({ message: error.message, reason: error.reason }, error.details);
|
||||
return updateApp(app, { installationState: apps.ISTATE_ERROR, error: appError }, callback.bind(null, error));
|
||||
return updateApp(app, { installationState: apps.ISTATE_ERROR, error: error.toPlainObject ? error.toPlainObject() : error.message }, callback.bind(null, error));
|
||||
}
|
||||
callback(null);
|
||||
});
|
||||
@@ -553,7 +552,8 @@ function backup(app, progressCallback, callback) {
|
||||
], function seriesDone(error) {
|
||||
if (error) {
|
||||
debugApp(app, 'error backing up app: %s', error);
|
||||
return updateApp(app, { installationState: apps.ISTATE_INSTALLED, error: { message: error.message } }, callback.bind(null, error)); // return to installed state intentionally
|
||||
// return to installed state intentionally
|
||||
return updateApp(app, { installationState: apps.ISTATE_INSTALLED, error: error.toPlainObject ? error.toPlainObject() : error.message }, callback.bind(null, error));
|
||||
}
|
||||
callback(null);
|
||||
});
|
||||
@@ -635,7 +635,7 @@ function configure(app, oldConfig, progressCallback, callback) {
|
||||
], function seriesDone(error) {
|
||||
if (error) {
|
||||
debugApp(app, 'error reconfiguring : %s', error);
|
||||
return updateApp(app, { installationState: apps.ISTATE_ERROR, error: { message: error.message }}, callback.bind(null, error));
|
||||
return updateApp(app, { installationState: apps.ISTATE_ERROR, error: error.toPlainObject ? error.toPlainObject() : error.message }, callback.bind(null, error));
|
||||
}
|
||||
callback(null);
|
||||
});
|
||||
@@ -744,7 +744,7 @@ function update(app, updateConfig, progressCallback, callback) {
|
||||
updateApp(app, { installationState: apps.ISTATE_INSTALLED, error: null, health: null }, callback.bind(null, error));
|
||||
} else if (error) {
|
||||
debugApp(app, 'Error updating app: %s', error);
|
||||
updateApp(app, { installationState: apps.ISTATE_ERROR, error: { message: error.message }, updateTime: new Date() }, callback.bind(null, error));
|
||||
updateApp(app, { installationState: apps.ISTATE_ERROR, error: error.toPlainObject ? error.toPlainObject() : error.message, updateTime: new Date() }, callback.bind(null, error));
|
||||
} else {
|
||||
if (updateConfig.skipNotification) return callback();
|
||||
|
||||
@@ -797,7 +797,7 @@ function uninstall(app, progressCallback, callback) {
|
||||
], function seriesDone(error) {
|
||||
if (error) {
|
||||
debugApp(app, 'error uninstalling app: %s', error);
|
||||
return updateApp(app, { installationState: apps.ISTATE_ERROR, error: { message: error.message } }, callback.bind(null, error));
|
||||
return updateApp(app, { installationState: apps.ISTATE_ERROR, error: error.toPlainObject ? error.toPlainObject() : error.message }, callback.bind(null, error));
|
||||
}
|
||||
callback(null);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user