Return error object in the API
This commit is contained in:
@@ -381,7 +381,7 @@ function getDataDir(app, dataDir) {
|
||||
|
||||
function removeInternalFields(app) {
|
||||
return _.pick(app,
|
||||
'id', 'appStoreId', 'installationState', 'errorMessage', 'runState', 'health', 'taskId',
|
||||
'id', 'appStoreId', 'installationState', 'error', 'runState', 'health', 'taskId',
|
||||
'location', 'domain', 'fqdn', 'mailboxName',
|
||||
'accessRestriction', 'manifest', 'portBindings', 'iconUrl', 'memoryLimit',
|
||||
'sso', 'debugMode', 'robotsTxt', 'enableBackup', 'creationTime', 'updateTime', 'ts', 'tags',
|
||||
@@ -391,7 +391,7 @@ function removeInternalFields(app) {
|
||||
// non-admins can only see these
|
||||
function removeRestrictedFields(app) {
|
||||
return _.pick(app,
|
||||
'id', 'appStoreId', 'installationState', 'errorMessage', 'runState', 'health', 'taskId',
|
||||
'id', 'appStoreId', 'installationState', 'error', 'runState', 'health', 'taskId',
|
||||
'location', 'domain', 'fqdn', 'manifest', 'portBindings', 'iconUrl', 'creationTime', 'ts', 'tags', 'label');
|
||||
}
|
||||
|
||||
@@ -587,7 +587,7 @@ function scheduleTask(appId, args, values, callback) {
|
||||
tasks.add(tasks.TASK_APP, [ appId, args ], function (error, taskId) {
|
||||
if (error) return callback(new AppsError(AppsError.INTERNAL_ERROR, error));
|
||||
|
||||
values.errorMessage = '';
|
||||
values.error = null;
|
||||
values.taskId = taskId;
|
||||
|
||||
appdb.setTask(appId, values, function (error) {
|
||||
@@ -599,7 +599,7 @@ function scheduleTask(appId, args, values, callback) {
|
||||
debug(`scheduleTask: task ${taskId} of $${appId} completed`);
|
||||
if (error && (error.crashed || error.stopped)) {
|
||||
debug(`Apptask crashed/stopped: ${error.message}`);
|
||||
appdb.update(appId, { installationState: appdb.ISTATE_ERROR, errorMessage: error.message, taskId: null }, NOOP_CALLBACK);
|
||||
appdb.update(appId, { installationState: appdb.ISTATE_ERROR, error: { message: error.message }, taskId: null }, NOOP_CALLBACK);
|
||||
} else if (values.installationState !== appdb.ISTATE_PENDING_UNINSTALL) {
|
||||
appdb.update(appId, { taskId: null }, NOOP_CALLBACK);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user