Compare commits

...

3 Commits

Author SHA1 Message Date
Andrew Henry
5de5ff347c Merge branch 'release/2.0.5' into persistence-errors 2022-07-12 11:44:21 -07:00
Andrew Henry
169d148c58 Revert some changes to minimize risk 2022-07-12 09:08:59 -07:00
Andrew Henry
40d2f3295f Better handling of persistence errors in general, and conflict errors specifically 2022-07-12 09:04:34 -07:00
2 changed files with 12 additions and 4 deletions

View File

@@ -230,6 +230,7 @@ export default class ObjectAPI {
return result;
}).catch((result) => {
console.warn(`Failed to retrieve ${keystring}:`, result);
this.openmct.notifications.error(`Failed to retrieve object ${keystring}`);
delete this.cache[keystring];
@@ -387,7 +388,13 @@ export default class ObjectAPI {
}
}
return result;
return result.catch((error) => {
if (error instanceof this.errors.Conflict) {
this.openmct.notifications.error(`Conflict detected while saving ${this.makeKeyString(domainObject.identifier)}`);
}
throw error;
});
}
/**

View File

@@ -217,9 +217,11 @@ class CouchObjectProvider {
this.indicator.setIndicatorToState(DISCONNECTED);
console.error(error.message);
throw new Error(`CouchDB Error - No response"`);
}
} else {
console.error(error.message);
console.error(error.message);
throw error;
}
}
}
@@ -653,7 +655,6 @@ class CouchObjectProvider {
let document = new CouchDocument(key, queued.model);
document.metadata.created = Date.now();
this.request(key, "PUT", document).then((response) => {
console.log('create check response', key);
this.#checkResponse(response, queued.intermediateResponse, key);
}).catch(error => {
queued.intermediateResponse.reject(error);